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(){ static $z=20; echo $z; $z++; } add(); echo $z; echo $z; echo $z;
based on 0uU8C
Output for 5.0.4 - 7.1.0
10<br>20 Notice: Undefined variable: z in /in/vMgbD on line 12 Notice: Undefined variable: z in /in/vMgbD on line 13 Notice: Undefined variable: z in /in/vMgbD on line 14
Output for 4.3.0 - 5.0.3
10<br>20 Notice: Undefined variable: z in /in/vMgbD on line 12 Notice: Undefined variable: z in /in/vMgbD on line 13 Notice: Undefined variable: z in /in/vMgbD on line 14