3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x=5;/* this multiline comment */ $y=10; //this is global echo $y; echo '<br>'; function add(){ $globals['a']=$globals['x']+$globals['y']; echo $a; } add(); echo $a;
based on 8uOOB
Output for 5.0.4 - 7.1.0
10<br> Notice: Undefined variable: globals in /in/TJhRO on line 7 Notice: Undefined variable: globals in /in/TJhRO on line 7 Notice: Undefined variable: a in /in/TJhRO on line 8 Notice: Undefined variable: a in /in/TJhRO on line 11
Output for 4.3.0 - 5.0.3
10<br> Notice: Undefined variable: globals in /in/TJhRO on line 7 Notice: Undefined variable: globals in /in/TJhRO on line 7 Notice: Undefined variable: a in /in/TJhRO on line 8 Notice: Undefined variable: a in /in/TJhRO on line 11