/ Published in: PHP
Ordena cualquier array multidimensional en base a un campo especÃfico
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function orderMultiDimensionalArray ($toOrderArray, $field, $inverse = false) { foreach ($toOrderArray as $key => $row) { $position[$key] = $row[$field]; $newRow[$key] = $row; } if ($inverse) { } else { } foreach ($position as $key => $pos) { $returnArray[] = $newRow[$key]; } return $returnArray; }