Doc #54009 [Csd->Bgs]: wrong call_user_func_array documentation

From: Date: Mon, 14 Feb 2011 11:45:16 +0000
Subject: Doc #54009 [Csd->Bgs]: wrong call_user_func_array documentation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5989@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54009&edit=1 ID: 54009 Updated by: cataphract@php.net Reported by: duke at ejoom dot com Summary: wrong call_user_func_array documentation -Status: Closed +Status: Bogus Type: Documentation Problem Package: Documentation problem PHP Version: 5.3.5 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2011-02-13 23:32:38] duke at ejoom dot com Sorry, I was wrong. It's all OK. ------------------------------------------------------------------------ [2011-02-13 23:15:55] duke at ejoom dot com Description: ------------ --- From manual page: http://www.php.net/function.call-user-func#Parameters --- The example script made an error. True example is: <?php error_reporting(E_ALL); function increment(&$var) { $var++; } $a = 0; call_user_func('increment', &$a); echo $a."\n"; call_user_func_array('increment', array(&$a)); // You can use this instead before PHP 5.3 echo $a."\n"; ?> And true output: 1 2 Bags are in line "call_user_func('increment', &$a);" and at output. Test script: --------------- <?php error_reporting(E_ALL); function increment(&$var) { $var++; } $a = 0; call_user_func('increment', &$a); echo $a."\n"; call_user_func_array('increment', array(&$a)); // You can use this instead before PHP 5.3 echo $a."\n"; ?> Output: 1 2 Expected result: ---------------- 1 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54009&edit=1

« previous php.doc.bugs (#5989) next »