Both method calls and member accesses can be overloaded via the
__call, __get and __set methods. These methods will only be
triggered when your object or inherited object doesn't contain the
member or method you're trying to access.
void __set ( string name, mixed value ) mixed __get ( mixed name )
Class members can be overloaded to run custom code defined in your class
by defining these specially named methods. The $name
parameter used is the name of the variable that should be set or retrieved.
The __set() method's $value parameter specifies the
value that the object should set set the $name.
Example 19-18. overloading with __get and __set example
<?php class Setter { public $n; private $x = array("a" => 1, "b" => 2, "c" => 3);
Class methods can be overloaded to run custom code defined in your class
by defining this specially named method. The $name
parameter used is the name as the function name that was requested
to be used. The arguments that were passed in the function will be
defined as an array in the $arguments parameter.
The value returned from the __call() method will be returned to the
caller of the method.
language.oop5.overloading php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php language.oop5.overloading syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.