Answer the question
In order to leave comments, you need to log in
Sorting multidimensional php array?
So it's not possible to sort the array of elements (root) by property value
Answer the question
In order to leave comments, you need to log in
en.php.net/manual/en/function.array-multisort.php
array_multisort
(PHP 4, PHP 5)
array_multisort - Sorts multiple arrays or multidimensional arrays
php.net/manual/en/function.usort.php
Write the desired cmp_function and sort as you please.
You can use the standard php uasort function You
can read it here
php uasort
uasort($Array, function($first, $second) {
if ($first->p == $second->p) {
return 0;
}
return ($first->p < $second->p) ? 1 : -1;
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question