|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-05-29 05:53 UTC] laruence@php.net
[2015-05-29 05:53 UTC] laruence@php.net
-Status: Open
+Status: Closed
[2016-07-20 11:38 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 02:00:01 2025 UTC |
Description: ------------ I get an unexpected behavior when passing an array by reference and after that try to use the function array_column. Test script: --------------- <?php function byReference( & $array){ foreach($array as &$item){ $item['nanana'] = 'batman'; $item['superhero'] = 'robin'; } } $array = [ [ 'superhero'=> 'superman', 'nanana' => 'no nana' ], [ 'superhero'=> 'acuaman', 'nanana' => 'no nana' ], ]; var_dump(array_column($array, 'superhero')); byReference($array); var_dump(array_column($array, 'superhero')); Expected result: ---------------- array(2) { [0]=> string(6) "batman" [1]=> string(6) "batman" } Actual result: -------------- array(0) { }