note 45230 rejected from function.call-user-func by aidan
| From: | aidan@php.net | Date: | Tue, 31 Aug 2004 06:54:22 +0000 |
| Subject: | note 45230 rejected from function.call-user-func by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75712@lists.php.net to get a copy of this message | ||
Note Submitter: mina86 at tlen dot pl
----
Yes... We see it again - Stupidity of PHP language. Passing arguments by reference is deprecated so
the solution postead @ 15-Aug-2004 10:11 is invalid (because deprecated). You could try using
something like <?php $reference($string); ?> however, then $reference would be converted into
a string 'Array' and en error would be triggered because function array does not exist
(note: array() is a language structure). The real sollution is as fallows:
<?php
class foo {
function bar(&$param) {
$param = "foo::bar()";
}
}
$foo = new foo();
$reference = array($foo,'bar');
$string = "I've been untouched";
call_user_func_array($reference, array(&$string));
echo $string; // outputs "foo::bar()"
?>