usleep 


php apg

DELAYS the program executions by a given number of  µs, (microseconds) .



<?php

void usleep 
int $microseconds )


where,

$microseconds Number of microseconds to delay the program execution
  
?>

 $microseconds 


Number of  µseconds , (microseconds), to delay the program execution.





1000000 µseconds = 1 second.

This function will generate a:

Warning: ... in PHP 7.4.XX
or
Fatal error: ... in PHP 8.0.XX,

if the provided number of µseconds is negative.



  1 EXERCISE   

<?php

$lang 
'en';

$str_tzg date_default_timezone_get();

$pt 'Fuso horário atual:<br>';
$en 'Current Time Zone:<br>';
$jp 'タイムゾーンセット:<br>';

echo 
'<br>' . $$lang  '&nbsp;' $str_tzg '<br><br>';

echo 
date("l F d Y H:i:s");
echo 
'<br><br>';

$microtime2sleep 3000000;
// 3 seconds

usleep($microtime2sleep);

echo 
date("l F d Y H:i:s");

?>

 RESULT   


Current Time Zone:
 America/Fortaleza

Thursday November 21 2024 06:50:22

Thursday November 21 2024 06:50:25