|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-09-13 07:28 UTC] spam2 at rhsoft dot net
[2017-09-13 12:18 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2017-09-13 12:18 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ The code is very simple and speaks for itself. Test script: --------------- <?php $data = array(array('name' => 'Lucas', 'surname' => 'Barrena')); foreach($data as &$row) {} #here, with reference #unset($row); #this line, fix everything $copy = $data; print_r($copy); #set, method A $data = array(array('name' => 'Lcs')); #method A-1: works #without foreach #method A-2: fails foreach($data as $row) {} #method B, fails #$data[0]['name'] = 'Lcs'; #without foreach print '<br>'; print_r($copy); #now copy it's different with methods fails Expected result: ---------------- $copy should not be different.