|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2002-02-26 21:40 UTC] yohgaki@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 21:00:02 2025 UTC | 
#This is pretty strange. #I didn't even know how to describe this $db = array( -1 => array('field0', 'field1', 'field2'), 'field0' => array(9, 2, 4, 8), 'field1' => array(333, 111, 333, 1), 'field2' => array(101010, 1, 22, 1111) ); for($i=0;$i<4;$i++){ foreach($db[-1] as $fieldname){ $db[$i][$fieldname] = &$db[$fieldname][$i]; } } #will print the same value (2) echo $db['field0'][1]; echo $db[1]['field0']; #we change $db['field0'][1] $db['field0'][1] = 2000; #will still print the same value (2000) echo $db['field0'][1]; echo $db[1]['field0']; array_multisort($db['field0'], $db['field1']); #we change $db['field0'][1] $db['field0'][1] = 600; #will print 600 echo $db['field0'][1]; #will print 2000 echo $db[1]['field0']; #the two values have been 'unlinked'? /* PLEASE NOTE this will work: array_multisort($db[0], $db[1]); #we change $db['field0'][1] $db['field0'][1] = 600; #will print the same value (600) echo $db['field0'][1]; echo $db[1]['field0']; */