3v4l.org

run code in 300+ PHP versions simultaneously
<?php const REQUIRED = 1; const OPTIONAL = 2; const IS_ARRAY = 4; $args = [ 'a' => [IS_ARRAY], 'b' => [OPTIONAL], 'c' => [REQUIRED], 'd' => [REQUIRED] ]; uasort( $args, function ($a, $b) { if ($a[0] & IS_ARRAY === IS_ARRAY) { echo "a is array\n"; return -1; } if ($b[0] & IS_ARRAY === IS_ARRAY) { echo "b is array\n"; return 1; } if ($a[0] & OPTIONAL === OPTIONAL) { echo "a is optional\n"; return -1; } if ($b[0] & OPTIONAL === OPTIONAL) { echo "b is optional\n"; return 1; } return 0; } ); var_dump($args);
Output for git.master_jit, git.master, rfc.property-hooks
b is array b is array b is array b is array a is array array(4) { ["c"]=> array(1) { [0]=> int(1) } ["d"]=> array(1) { [0]=> int(1) } ["a"]=> array(1) { [0]=> int(4) } ["b"]=> array(1) { [0]=> int(2) } }

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:
78.1 ms | 402 KiB | 8 Q