3v4l.org

run code in 200+ PHP versions simultaneously
<?php $a = []; $keys = [ 'array' => [], 'object' => new stdClass, 'closure' => function () {}, 'class' => new class {}, 'class with tostring' => new class {function __toString(){return 'to string class';}}, 'resource' => fopen(__FILE__, 'r'), ]; foreach ($keys as $desc =>$key) { echo "===" . $desc . "===\n"; $a[$key] = true; echo "state of array: \n"; var_dump($a); echo "state of key: \n"; var_dump($key); echo "is the key set in the array: \n"; var_dump(isset($a[$key])); } echo "===============\n"; var_dump($a);
based on 3lpob

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch php-master
===array=== Fatal error: Uncaught TypeError: Illegal offset type in /in/cQ8hf:16 Stack trace: #0 {main} thrown in /in/cQ8hf on line 16
Process exited with code 255.
Output for branch php-master+opcache
===array=== Fatal error: Uncaught TypeError: Illegal offset type in /in/cQ8hf:16 Stack trace: #0 {main} thrown in /in/cQ8hf on line 16
Process exited with code 255.
Output for branch php-master+jit
===array=== Fatal error: Uncaught TypeError: Illegal offset type in /in/cQ8hf:16 Stack trace: #0 {main} thrown in /in/cQ8hf on line 16
Process exited with code 255.

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