setTimeout()
/**
* This function is used to run a callback in the event loop with timeout
*/
public static function setTimeout(callable $callback, int $timeout): SampleMacro;System::setTimeout(function() {
echo "Hello World\n";
}, 5000);Hello World // after 5 seconds. /**
* This function is used to clear the timeout
*/
public static function clearTimeout(SampleMacro $sampleMacro): void;$timeout = System::setTimeout(function() {
echo "Hello World\n";
}, 5000);
System::clearTimeout($timeout);Last updated