diff --git a/appendices/migration5.xml b/appendices/migration5.xml index 7bf3fdc468..6161abc4a1 100755 --- a/appendices/migration5.xml +++ b/appendices/migration5.xml @@ -1,5 +1,5 @@ - + Migrating from PHP 4 to PHP 5 @@ -1308,7 +1308,9 @@ $object = new ClassName; Both method calls and property accesses can be overloaded via the __call, __get and - __set methods. + __set methods. These methods will only be + triggered when your object doesn't contain the property or method + your're trying to access. @@ -1346,7 +1348,6 @@ class Setter { } } - $foo = new Setter(); $foo->n = 1; $foo->a = 100; @@ -1356,9 +1357,36 @@ var_dump($foo); ?> ]]> </programlisting> + <screen role="php"> +<![CDATA[ +Setting [a] to 100 +OK! +Getting [a] +Returning: 100 +Setting [a] to 101 +OK! +Getting [z] +Nothing! +Setting [z] to 1 +Not OK! +object(Setter)#1 (2) { + ["n"]=> + int(1) + ["x"]=> + array(3) { + ["a"]=> + int(101) + ["b"]=> + int(2) + ["c"]=> + int(3) + } +} +]]> + </screen> </example> <example> - <title><function>__get</function> example + <function>__call</function> example