PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i am working from Luke Welling and Laura Thomson's book
in the chapter of OOP function __set is explained. as i understand it is important to acces the attributes, and there is an example like this
$a = new class1();
$a->__set('attribute', 110);
var_dump($a->attribute);
I dont think it would work.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
actually i'm probably wrong (i haven't worked with this before)
are you running php5?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
B. It first checks if the property exists and is public, if its not then __set() or __get() is called. So in your code its going to set attribute directly and ignore __set(). However if you called $a->taco it would call set since taco is not defined.
$a = new class1();
$a->__set('attribute', 110);
var_dump($a->attribute);
and it works. but here we call the function __set as i read from that book (L.W and L.T) the function __set must work directly like function __construct and __destruct()