Hi, all.

I found problem of call_user_func() with passing by reference.

In test code, I expect that $test1 and $test2 and $test3 are
overwritten by MyFunction. However, $test2 is not overwritten.
Is this right behavior?

following test code:
<?php
$test1 = 'NG';
MyFunction($test2);

$test2 = 'NG';
call_user_func('MyFunction', $test2);

$test3 = 'NG';
call_user_func('MyFunction', &$test3);

print '$test1 is ' . $test1 . "\n";
print '$test2 is ' . $test2 . "\n";
print '$test3 is ' . $test3 . "\n";

exit();

function MyFunction(&$arg) {
    $arg = 'OK';
}
?>

--
KUBO Atsuhiro e-mail: [EMAIL PROTECTED]

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to