note 26104 deleted from function.list by wez

From: Date: Thu, 15 May 2003 20:11:38 +0000
Subject: note 26104 deleted from function.list by wez
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48039@lists.php.net to get a copy of this message
list() does some strange things with re-ordering array elements. $baz = array(1,2,3) # print_r($baz) shows: # Array ( [0] => 1 [1] => 2 [2] => 3 ) # then: $foo = "a:b:c"; list($bar[0],$bar[1],$bar[2]) = split(":",$foo); # print_r($baz) shows: # Array ( [2] => c [1] => b [0] => a ) # list() has assigned them backwards AND re-ordered the keys of the array. list($baz[2],$baz[1],$baz[0]) = split(":",$foo); # Array ( [0] => c [1] => b [2] => a ) print join(":",$bar); print join(":",$baz); # BOTH print "c:b:a" This isn't really a bug, but something to watch out for, considering join(":",split(":","a:b:c")) returns "a:b:c" as expected.

« previous php.notes (#48039) next »