3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(); echo PHP_EOL . ' on empty array: ' . PHP_EOL; var_dump(key($array)); $array[] = 'f'; echo PHP_EOL . ' size one array: ' . PHP_EOL; var_dump(key($array)); $array[] = 'f'; echo PHP_EOL . ' size two array: ' . PHP_EOL; var_dump(key($array)); echo PHP_EOL . ' within loop: ' . PHP_EOL; foreach ($array as $item) { var_dump(key($array)); } echo PHP_EOL . ' after loop: ' . PHP_EOL; var_dump(key($array)); reset($array); echo PHP_EOL . ' after reset: ' . PHP_EOL; var_dump(key($array)); end($array); echo PHP_EOL . ' after end: ' . PHP_EOL; var_dump(key($array)); echo PHP_EOL . ' trying to trigger "Undefined index: " error: with NULL key' . PHP_EOL; $array[null]; echo PHP_EOL . ' trying to trigger "Undefined index: " error: with empty string key' . PHP_EOL; $array[''];
Output for git.master, git.master_jit, rfc.property-hooks
on empty array: NULL size one array: int(0) size two array: int(0) within loop: int(0) int(0) after loop: int(0) after reset: int(0) after end: int(1) trying to trigger "Undefined index: " error: with NULL key Warning: Undefined array key "" in /in/lsXp5 on line 31 trying to trigger "Undefined index: " error: with empty string key Warning: Undefined array key "" in /in/lsXp5 on line 34

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