|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-02 13:45 UTC] bjori@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 00:00:01 2025 UTC |
Description: ------------ list() seems to fill in the variable values "backwards", which results in the array index variable being incremented before all values are assigned. Reproduce code: --------------- <?php $ads=array(); $i=0; $date = "2006-01-30"; $nr = "00423364"; $file = "2006-01-30_00423364.jpg"; list($ads[$i]['publ'],$ads[$i]['nr'],$ads[$i++]['fil']) = array($date,$nr,$file); print_r($ads); ?> Expected result: ---------------- Array ( [0] => Array ( [fil] => 2006-01-30_00423364.jpg [nr] => 00423364 [publ] => 2006-01-30 ) ) (as in 5.0.4) Actual result: -------------- Array ( [0] => Array ( [fil] => 2006-01-30_00423364.jpg ) [1] => Array ( [nr] => 00423364 [publ] => 2006-01-30 ) )