3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array( 'nome' => 'Alexandre', 'idade' => '65' ), array( 'nome' => 'Alex', 'idade' => '33' ), array( 'nome' => 'Zezinha', 'idade' => '29' ), array( 'nome' => 'Rosana', 'idade' => '64' ) ); function Ordena_Array ($array, $campo) { // Compara se $a é maior que $b $callback = function ($a, $b) use ($campo) { return $a[$campo] > $b[$campo]; }; // Ordena usort($array, $callback); return $array; } // Mostra os valores print_r( Ordena_Array ($array, "nome") );
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/oMtYS on line 17 Array ( [0] => Array ( [nome] => Alex [idade] => 33 ) [1] => Array ( [nome] => Alexandre [idade] => 65 ) [2] => Array ( [nome] => Rosana [idade] => 64 ) [3] => Array ( [nome] => Zezinha [idade] => 29 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
24.94 ms | 407 KiB | 5 Q