Do not understand the call_user_func_array and the referenced code.
class PbObject{var $params;var $fontFace = 'incite.ttf';function Object() {$args = func_get_args();if (method_exists($this, '__destruct')) {register_shutdown_function (array(&$this, '__destruct'));}call_user_func_array(array(&$this, '__construct'), $args);}function __construct(){}function toString() {$class = get_class($this);return $class;}}
In this code, will call_user_func_array (array (& $ this, '_ construct'), $ args); why is a quote prefixed with $ this &? I have never understood such code. Can the _ construct method be called without adding or not? What is the role of adding?
Reply to discussion (solution)
When call_user_func_array calls a class method, the class (object) and method name must be transmitted simultaneously with arrays.
Your $ this is the object.
In php4, the object is passed as a value by default. If no declaration (&) is referenced, it is actually executed on another object. if the class attribute is modified in the method, the modification will not apply to the caller.
In php5, all objects are passed by reference, so there is no need to name &
In your code, use var to declare class attributes, which is obviously php4-style
Php4 class has no destructor, so the code uses register_shutdown_function to register
I used to learn about the version.