3v4l.org

run code in 500+ PHP versions simultaneously
<?php // First class callable function a() { static $c = 0; return $c++; } $c = a(...); $c = function () { static $c = 0; return $c++; }; print $c(); print $c(); $d = clone $c; print $d(); ?>
Output for 8.2.31 - 8.2.32, 8.3.5 - 8.3.32, 8.4.9 - 8.4.23, 8.5.6 - 8.5.8
012

preferences:
57.08 ms | 537 KiB | 4 Q