I am very confused why $produk1->harga = 500; can still make a change (or re-assign the value 500) to private $harga property despite private $harga in class Produk has PRIVATE visibility ? $product1 is an instance of class Komik. $produk1 = new Komik(“Naruto”, “Masashi Kishimoto”, “Shonen Jump”, 30000, 100); And by echo $produk1->harga; it prints out 500 and not an
Tag: private
Twig accessing protected/private model variables
I have a problem with Twig, (in fact this is not really a problem but it’s disturbing to me) I have a Post model class in php and i have some protected variables (I also tried with private). To acces them I have a public function in php getMyVariable. If in my controller I try to echo the protected variable