3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test1($unset = false) { static $bar = 1; $bar++; echo $bar; unset($bar); $bar = "|"; echo $bar; // this initialization value is hoisted to the top of the function! static $bar = 5; $bar++; echo $bar; echo " "; static $bar = 77; } var_dump($bar); test1(); test1(); test1(); test1();
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: bar in /in/kuZGc on line 24 NULL 78|79 80|81 82|83 84|85
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: bar in /in/kuZGc on line 24 NULL 78|79 80|81 82|83 84|85