- sleep: documentation ( source)
<?php
(new class {
private $recursion = 0; // just so we don't abuse 3v4l
function __invoke() {
echo "all by myself...", PHP_EOL;
$this->recursion++;
sleep(1);
if($this->recursion < 3) $this();
}
})();