3v4l.org

run code in 300+ PHP versions simultaneously
<?php $payload = [ ['other_value_y' => 'y', 'reference' => '423-52', 'other_value_x' => 'x'], ['other_value_y' => 'y', 'reference' => '223-52', 'other_value_x' => 'x'], ['other_value_y' => 'y', 'reference' => '5423-52', 'other_value_x' => 'x'], ['other_value_y' => 'y', 'reference' => '823-52', 'other_value_x' => 'x'], ['other_value_y' => 'y', 'reference' => '123-52', 'other_value_x' => 'x'], ]; usort($payload, static function (array $a, array $b) { if (!isset($a['reference']) || !isset($b['reference'])) { throw new \RuntimeException('Missing array key "reference"', 1671615426); } // "Remove all characters except digits, plus and minus sign." // (consequence `-123-45-67` is treated as (negative) `-1234567`) // sse https://www.php.net/manual/en/filter.filters.sanitize.php return filter_var($a['reference'], FILTER_SANITIZE_NUMBER_INT) <=> filter_var($b['reference'], FILTER_SANITIZE_NUMBER_INT); }); print_r($payload);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [other_value_y] => y [reference] => 123-52 [other_value_x] => x ) [1] => Array ( [other_value_y] => y [reference] => 223-52 [other_value_x] => x ) [2] => Array ( [other_value_y] => y [reference] => 423-52 [other_value_x] => x ) [3] => Array ( [other_value_y] => y [reference] => 5423-52 [other_value_x] => x ) [4] => Array ( [other_value_y] => y [reference] => 823-52 [other_value_x] => x ) )

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