3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "\n#1: hello\n"; $a = 'hello'; var_dump($a['test']); // notice, but fetches the first char 'h' (undefined/null = 0) var_dump($a[false]); // notice, but fetches the first char 'h' (false = 0) var_dump($a[true]); // notice, but fetches the second char 'e' (true = 1) var_dump($a['2']); // notice, but fetches the second char 'e' (true = 1) echo "\n#2: 42\n"; $a = 42; var_dump($a['test']); // NO NOTICE, returns null var_dump($a[1]); // NO NOTICE, returns null var_dump($a[2]); // NO NOTICE, returns null echo "\n#2: null\n"; $a = null; var_dump($a['test']); // NO NOTICE, returns null var_dump($a[1]); // NO NOTICE, returns null var_dump($a[2]); // NO NOTICE, returns null echo "\nHave fun with it...\nbest regards,\nyour PHP";
Output for git.master, git.master_jit, rfc.property-hooks
#1: hello Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/XVA87:4 Stack trace: #0 {main} thrown in /in/XVA87 on line 4
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:
28.89 ms | 405 KiB | 5 Q