3v4l.org

run code in 500+ PHP versions simultaneously
<?php function bar() { echo "bar() called\n"; return 1; } function foo() { static $i = bar(); echo $i++, "\n"; } foo(); foo(); foo();
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.6
bar() called 1 2 3
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30
Fatal error: Constant expression contains invalid operations in /in/bAFd9 on line 9
Process exited with code 255.

preferences:
66.89 ms | 1115 KiB | 4 Q