Bug #69330 [Opn]: SORT_* DOESN'T WORK in array_multisort

From: Date: Mon, 30 Mar 2015 08:16:33 +0000
Subject: Bug #69330 [Opn]: SORT_* DOESN'T WORK in array_multisort
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191709@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69330&edit=1 ID: 69330 User updated by: to dot yashin at gmail dot com Reported by: to dot yashin at gmail dot com -Summary: SORT_* DOSNT WORK in array_multisort +Summary: SORT_* DOESN'T WORK in array_multisort Status: Open Type: Bug Package: Scripting Engine problem Operating System: ubuntu PHP Version: 5.5.23 Block user comment: N Private report: N New Comment: //Grammar Nazi DOSNT => DOESN'T Previous Comments: ------------------------------------------------------------------------ [2015-03-30 07:59:09] to dot yashin at gmail dot com Description: ------------ The second optional parameter array1_sort_order=SORT_DESC in array_multisort function does not work Test script: --------------- <?php $result = array( array( 'position' => 1, 'col1' => 10, 'col2' => 10, ), array( 'position' => 2, 'col1' => 12, 'col2' => 10, ), array( 'position' => 3, 'col1' => 10, 'col2' => 11, ), ); $col1_data = array(); $col2_data = array(); foreach ($result as $key => $row) { $col1_data[] = intval($row['col1']); $col2_data[] = intval($row['col2']); } // SORT_DESC ! array_multisort($result, SORT_DESC, SORT_NUMERIC, $col1_data, $col2_data); foreach ($result as $row) { echo $row['position'], ' '; } echo "\n"; // Actual: 1 3 2 // Expected: 2 3 1 Expected result: ---------------- Sort Descending correct: 2 3 1 Actual result: -------------- Sort Descending is not correct: 1 3 2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69330&edit=1

« previous php.bugs (#191709) next »