3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test() { echo $var, PHP_EOL; // Notice: Undefined variable: var global $var; echo $var, PHP_EOL; // blue unset($var); echo $var, PHP_EOL; // Notice: Undefined variable: var global $var; echo $var, PHP_EOL; // blue $var = 'red'; echo $var, PHP_EOL; // red unset($var); echo $var, PHP_EOL; // Notice: Undefined variable: var global $var; echo $var, PHP_EOL; // red } $var = 'blue'; echo $var, PHP_EOL; // blue test(); echo $var, PHP_EOL; // red
Output for 5.0.4 - 5.0.5, 5.1.1 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
blue Notice: Undefined variable: var in /in/BGHlu on line 6 blue Notice: Undefined variable: var in /in/BGHlu on line 10 blue red Notice: Undefined variable: var in /in/BGHlu on line 17 red red
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/BGHlu on line 25
Process exited with code 255.
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.0.3
blue Notice: Undefined variable: var in /in/BGHlu on line 6 blue Notice: Undefined variable: var in /in/BGHlu on line 10 blue red Notice: Undefined variable: var in /in/BGHlu on line 17 red red
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
blue Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 23 PHP_EOL Notice: Undefined variable: var in /in/BGHlu on line 6 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 6 PHP_EOLblue Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 8 PHP_EOL Notice: Undefined variable: var in /in/BGHlu on line 10 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 10 PHP_EOLblue Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 12 PHP_EOLred Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 15 PHP_EOL Notice: Undefined variable: var in /in/BGHlu on line 17 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 17 PHP_EOLred Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 19 PHP_EOLred Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/BGHlu on line 25 PHP_EOL