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.5.7
012

preferences:
40.32 ms | 480 KiB | 4 Q