3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test1($unset = false) { // PHP establishes an internal static var and binds // the local name 'bar' to it static $bar = 0; // unlink the name 'bar' from the internal static var unset($bar); // we can reuse $bar! $bar = " this is crazy "; echo $bar; // rebind 'bar' to the internal static var! static $bar; $bar++; echo $bar; } test1(); test1(); test1(); test1();
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
this is crazy 1 this is crazy 2 this is crazy 3 this is crazy 4
Output for hhvm-3.10.0

Process exited with code 153.