3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['columnName' => 3], ['columnName' => 4], ['columnName' => 1], ['columnName' => 3], ['columnName' => 2], ['columnName' => 5] ]; $direction = 'asc'; $factor = $direction === 'desc' ? -1 : 1; $c = 'columnName'; usort( $array, fn($a, $b) => $factor * ($a[$c] <=> $b[$c]) ); var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'columnName' => 1, ), 1 => array ( 'columnName' => 2, ), 2 => array ( 'columnName' => 3, ), 3 => array ( 'columnName' => 3, ), 4 => array ( 'columnName' => 4, ), 5 => array ( 'columnName' => 5, ), )

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:
79.75 ms | 406 KiB | 5 Q