3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myTest(){ static $x=0; echo "$x"; $x++; } myTest(); echo "$x++"; myTest(); echo "$x++"; myTest(); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
0 Warning: Undefined variable $x in /in/FcIq3 on line 8 ++1 Warning: Undefined variable $x in /in/FcIq3 on line 10 ++2
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.21, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
0 Notice: Undefined variable: x in /in/FcIq3 on line 8 ++1 Notice: Undefined variable: x in /in/FcIq3 on line 10 ++2
Output for 7.3.32 - 7.3.33
0++1++2

preferences:
158.03 ms | 401 KiB | 200 Q