3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1($unset = false) { // PHP establishes an internal static var and binds // the local name 'bar' to it static $bar = 0; $bar++; echo $bar; // 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();

preferences:
35.96 ms | 402 KiB | 5 Q