|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-07-08 13:03 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010-07-08 13:03 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 10:00:01 2025 UTC |
Description: ------------ third parameters of array_walk function is not changing unless I used the deprecated syntax of call-by-reference Deprecated message is shown and its working properly that way. Test script: --------------- $cont = 0; $sampleArray = array(0,1,1,2,3,5,8,13); $foo = function($item,$key,$aux){ $aux++; }; array_walk($sampleArray,$foo,$cont); echo $cont; // it's ok. cont = 0, no call-by-reference echo "<hr>"; $cont = 0; $foo = function($item,$key,&$aux){ $aux++; }; array_walk($sampleArray,$foo,$cont); echo $cont; // it should be same as count($sampleArray) but it is 0 BUG! echo "<hr>"; $cont = 0; $foo = function($item,$key,&$aux){ $aux++; }; array_walk($sampleArray,$foo,&$cont); echo $cont; // it is 8, perfect but Deprecated: Call-time pass-by-reference has been deprecated Expected result: ---------------- 0,8,8 should by right but 0,0,8