ID:               36502
 Updated by:       [EMAIL PROTECTED]
 Reported By:      kevin at theposseltd dot com
-Status:           Feedback
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Linux
 PHP Version:      4.4.2
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2006-02-23 23:07:22] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2006-02-23 23:03:42] 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



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36502&edit=1

Reply via email to