|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-06 19:06 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 21:00:01 2025 UTC |
Description: ------------ I'm not sure is a bug but I don't understand why the first block is executed correctly whereas the second one (same code) returns with this warning: Warning: array_multisort() [function.array-multisort]: Array sizes are inconsistent in /usr/local/httpd-2.2.0/htdocs/test/multisort.php on line 27 Reproduce code: --------------- <? error_reporting(E_ALL); // first block $data = array(); $data[2] = array('volume' => 67, 'edition' => 2); $data[3] = array('volume' => 86, 'edition' => 1); foreach ($data as $key => $row) { $volume[$key] = $row['volume']; $edition[$key] = $row['edition']; } array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); // second block (equal to first block) $data = array(); $data[2] = array('volume' => 67, 'edition' => 2); $data[3] = array('volume' => 86, 'edition' => 1); foreach ($data as $key => $row) { $volume[$key] = $row['volume']; $edition[$key] = $row['edition']; } array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); ?> Expected result: ---------------- Both blocks give the same result. Actual result: -------------- Warning: array_multisort() [function.array-multisort]: Array sizes are inconsistent in /usr/local/httpd-2.2.0/htdocs/test/multisort.php on line 27