call_user_func

From: Date: Mon, 14 Jul 2003 11:43:00 +0000
Subject: call_user_func
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969355188@lists.php.net to get a copy of this message
Hello there I think I found an undocumented behavior in the 'call_user_func' function in PHP version 4.3.1. All arguments are passed by value, even if you call a function that takes its arguments by reference. Here is my example: <?php function createString( &$arg ) { $arg = 'Hello World'; } // calling the function normally createString( $stdCall ); echo "<p>'createString($stdCall)' works: '$stdCall'</p>"; // calling the function by using a variable as functionname $funcName = 'createString'; $funcName( $varCall ); echo "<p>'$func($varCall)' works: '$varCall'</p>"; // calling the function by call_user_func call_user_func( 'createString', $userCall ); echo "<p>'call_user_func( 'createString', $userCall )' does not work: '$userCall'</p>"; ?> greetings Philipp Benjamin Köpchen

« previous php.doc (#969355188) next »