3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function f() { return new class { function foo() { static $i = 0; echo ++$i; } }; } f()->foo(); f()->foo();
based on lCWhn
Output for 7.0.0 - 7.3.0alpha1
12
Output for 5.6.0 - 5.6.29
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/vuHR1 on line 5
Process exited with code 255.