3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(array $array) { try { return isDictionary($array); } catch (Exception $e) { echo 'ss'; return 'error'; } } function isDictionary($array) { foreach($array as $key => $value) { return ! is_int($key); } return false; } assert(isDictionary(['', 'a', 'b'])); assert(isDictionary([1 => 'a', 2 => 'b', 3 => 'c'])); assert(isDictionary([0 => '', 2 => 'b'])); assert(isDictionary([0 => '', 2 => 'b', 1 => 'a'])); assert(isDictionary([0 => '', 3 => 'c', 2 => 'b'])); assert(isDictionary([0 => '', null => '', 2 => 'b'])); assert(isDictionary([null => '', 1 => 'a', 2 => 'b']));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught AssertionError: assert(isDictionary(['', 'a', 'b'])) in /in/nfPn3:23 Stack trace: #0 /in/nfPn3(23): assert(false, 'assert(isDictio...') #1 {main} thrown in /in/nfPn3 on line 23
Process exited with code 255.

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:
51.32 ms | 401 KiB | 8 Q