3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(){ static $int = 0; // correct static $int = 1+2; // wrong (as it is an expression) static $int = sqrt(121); // wrong (as it is an expression too) $int++; echo $int; }
based on GAlu1
Output for 7.0.0 - 7.0.5
Fatal error: Constant expression contains invalid operations in /in/Yvqpc on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.19
Parse error: syntax error, unexpected '(', expecting ',' or ';' in /in/Yvqpc on line 5
Process exited with code 255.
Output for 5.5.0 - 5.5.33
Parse error: syntax error, unexpected '+', expecting ',' or ';' in /in/Yvqpc on line 4
Process exited with code 255.