Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Delay execution
<?php sleep(int $seconds): int
<?php $app->register('sleep')

    ->setCode(function (InputInterface $input, OutputInterface $output): int {

        sleep(120);

        return Command::SUCCESS;

    })

;
<?php if (isset($_GET['sleep'])) {

    error_log('This is a log');

    sleep(10);

}



if (isset($_GET['img'])) {
<?php error_log('This is a log message');



$timeout = (int) ($_GET['timeout'] ?? 10);

$result = sleep($timeout);



if ($result && $timeout > 0) {

    throw new Exception('The execution continued after sleep was interrupted!');