- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
time_nanosleep() function in PHP
The time_nanosleep() function delays execution of the current script for few seconds and nanoseconds.
Syntax
time_nanosleep(sec, nsec)
Parameters
sec − The number of seconds to delay the script.
nsec − The number of nanoseconds to delay the script.
Return
The time_nanosleep() function returns true on success.
Example
<?php echo date('h:i:s') . "<br>"; // wait for 1.5 seconds time_nanosleep(1,500000000); echo date('h:i:s') . "<br>"; // wait for 2.5 seconds time_nanosleep(2,500000000); echo date('h:i:s'); ?>
Output
The following is the output.
02:57:04 02:57:06 02:57:08
Advertisements