|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-02-23 23:03 UTC] kevin at theposseltd dot com
Description:
------------
My development system is Windows based (XP)PHP 4.4.0 and after uploading the code to my hosting server (LINUX PHP 4.4.2) I get error messages when running the code, which worked fine on Windows. Nobody seems to be able to help me - so I suspect it may be a bug or inconsistency between 4.4.0 and 4.4.2
I am trying to sort a multidimensional array using array_multisort - the coding works perfectly on my development system but not on the Linux host site.
Reproduce code:
---------------
array structure looks like ... (line taken from actual structure)
[17] => Array ( [0] => 98 [event_ID] => 98 [1] => 5 [event_code] => 5 [2] => 0 [event_SIG_code] => 0 [3] => Attraction [event_type] => Attraction [4] => Lookout Discovery Centre [event_name] => Lookout Discovery Centre [5] => Party [event_description] => Party [6] => OmVMYV [event_geocode] => OmVMYV [7] => RG12 7QW [event_postcode] => RG12 7QW [8] => 2005-10-07 [event_start_date] => 2005-10-07 [distance] => Array ( [kilometers] => 43.55 [meters] => 43545.49 [miles] => 27.06 [furlongs] => 216.46 [feet] => 142865.79 [yards] => 47621.93 [inches] => 1714389.5 [nautical] => 23.51 [error] => 0 ) )
Code causing the issue ...
foreach ($sort_result as $res) {
$sortAux[] = $res['event_code'];
array_multisort($sortAux, SORT_ASC,$sort_result);}
// Re-sorts the GeoCode array by event_code
Expected result:
----------------
Expect the array to be sorted by 'event_code'(as it does in Windows system)
Actual result:
--------------
Actual error output:
Warning: array_multisort(): Array sizes are inconsistent in /content/StartupHostPlus/t/e/tellmewhatson.co.uk/web/event_headline_search.php on line 65
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 05:00:02 2025 UTC |
Your code is not going to work. Look at the numbers this code outputs: <?php $sort_array = Array( Array ('event_id', 11, 'event_type', 'Attraction', 'event_name', 'Discovery Centre'), Array ('event_id', 7, 'event_type', 'Normal', 'event_name', 'Party' ), Array ('event_id', 1, 'event_type', 'Feature','event_name', 'Twyford Zoo' ), Array ('event_id', 12, 'event_type', 'Normal', 'event_name', 'Market Day' ), Array ('event_id', 4, 'event_type','Attraction', 'event_name', 'Bowling Alley' ), ); foreach ($sort_array as $res) { $sortAux[] = $res[1]; var_dump(count($sortAux)); var_dump(count($sort_array)); array_multisort($sortAux, SORT_ASC, $sort_array); } ?> Not PHP problem -> bogus.