1
I have an nxm array which I call $tabela
.
This array has some inside data organized as follows:
| Papel1 | Hora1 | Valor1 | Erro | B | | Papel2 | Hora2 | Valor2 | OK_Ok | A | | Papel3 | Hora3 | Valor3 | Falha | C | | Papel4 | Hora4 | Valor4 | OK_OK | A |
All table data is extracted from a table mysql
, except the last column I insert into the array based on some conditions.
My question is, how to alphabetize all rows of the array based on the last column? It would have to return this way:
| Papel2 | Hora2 | Valor2 | OK_Ok | A | | Papel4 | Hora4 | Valor4 | OK_OK | A | | Papel1 | Hora1 | Valor1 | Erro | B | | Papel3 | Hora3 | Valor3 | Falha | C |
Array ( [0] => Array ( [0] => MIL EUA [1] => 2018-03-05 14:00:13 [3] => 168.99 [2] => 2018-03-05 15:00:11 [4] => 168.99 [5] => Atraso entre os servidores de 59 minutos ) [1] => Array ( [0] => TRIGQQNP [1] => 2018-03-05 14:00:15 [3] => 3800.00 [2] => 2018-03-05 15:00:12 [4] => 3800.00 [5] => Atraso entre os servidores de 59 minutos ) )
Possible duplicate of sort multidimensional array php
– Marcelo de Andrade
puts the array structure please use print_r or var_dump in a relatively average array example.
– Guilherme Nascimento