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; // 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 git.master, git.master_jit
this is crazy 1 this is crazy 2 this is crazy 3 this is crazy 4
Output for rfc.property-hooks
Fatal error: Duplicate declaration of static variable $bar in /in/JTc71 on line 16
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.85 ms | 401 KiB | 8 Q