Sortieren Sie Einzelelementreihen eines 2D-ArraysPhp

PHP-Programmierer chatten hier
Guest
 Sortieren Sie Einzelelementreihen eines 2D-Arrays

Post by Guest »

Ich kämpfe darum, dieses Array zu sortieren. < /p>
Es handelt sich

Code: Select all

$distanceArray[] = array($attractionID => $tempDistance);
< /code>
Die Ausgabe: < /p>
Array
(
[0] => Array (
[4] => 114.4
)

[1] => Array (
[3] => 16.1
)

[2] => Array (
[2] => 15
)

[3] => Array (
[1] => 21.4
)
)
< /code>
Ich habe dies ohne Glück versucht: < /p>
function cmp($a, $b)
{
return $a['tempDistance'] - $b['tempDistance'];
}

usort($distanceArray, "cmp");
und auch krsort () , aber ohne Glück.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post