ID: 16464 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: All PHP Version: 4.1.2 New Comment:
This request is virtually the same as bug #6427. Previous Comments: ------------------------------------------------------------------------ [2002-04-06 13:38:31] [EMAIL PROTECTED] Think of a factory function that creates an object of various classes by calling that object's constructor with the same arguments. If a constructor needs a reference (perhaps to another object), this is not possible if you want to write clean code without tricks like hard-code arguments with default values. ------------------------------------------------------------------------ [2002-04-06 13:32:07] [EMAIL PROTECTED] The function func_get_arg() and func_get_args() should support being called to return references: function do_something() { $args = func_get_args(); for ($i=0; $i<count($args); $i++) { do_something_with($args[$i]); } } $ref = new Object(); do_something(&$ref, "String", 0, 1.5); This function could register a dynamic number of variables to the session (references for the Object!!!), create an array or simple call another function with exactly the same arguments. I think it should be no problem for func_get_arg[s]() to save references passed to the function. Like function x($arg1, $arg2) { $args = array(&$arg1, &$arg2); } saves $arg1 and $args by reference if they are passed by reference or by value if they are passed by value. Thank you, looking forward to the new object model in Zend 2!!! Ferdinand Beyer <[EMAIL PROTECTED]> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16464&edit=1