3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "id" => 1, "recipient" => "User", "userName" => "Max Mustermann", "locationName" => "Test Location" ], [ "id" => 2, "recipient" => "Location", "userName" => "Susi Mustermann", "locationName" => "Another Location" ], [ "id" => 3, "recipient" => "Location", "userName" => "Susi Mustermann", "locationName" => "Wow Much Location" ], [ "id" => 4, "recipient" => "User", "userName" => "Fritz Kalkbrenner", "locationName" => "Good Music" ], [ "id" => 5, "recipient" => "Location", "userName" => "Paul Kalkbrenner", "locationName" => null ], ]; usort($array,function($a,$b){ $sort2key = strtolower($a['recipient']).'Name'; return $a['recipient'] <=> $b['recipient'] ?: is_null($a['locationName']) <=> is_null($b['locationName']) ?: $a[$sort2key] <=> $b[$sort2key]; }); var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'id' => 2, 'recipient' => 'Location', 'userName' => 'Susi Mustermann', 'locationName' => 'Another Location', ), 1 => array ( 'id' => 3, 'recipient' => 'Location', 'userName' => 'Susi Mustermann', 'locationName' => 'Wow Much Location', ), 2 => array ( 'id' => 5, 'recipient' => 'Location', 'userName' => 'Paul Kalkbrenner', 'locationName' => NULL, ), 3 => array ( 'id' => 4, 'recipient' => 'User', 'userName' => 'Fritz Kalkbrenner', 'locationName' => 'Good Music', ), 4 => array ( 'id' => 1, 'recipient' => 'User', 'userName' => 'Max Mustermann', 'locationName' => 'Test Location', ), )

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:
28.31 ms | 407 KiB | 5 Q