3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT # one # two a-two b-two c-two # three a-three b-three # four TEXT; echo preg_replace_callback( "~^#~m", function () { static $counter = 0; return ++$counter; }, $text );

preferences:
118.92 ms | 1363 KiB | 5 Q