<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Delay execution in microseconds</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.unpack.html">unpack</a></div> <div class="next" style="text-align: right; float: right;"><a href="changelog.misc.html">Changelog</a></div> <div class="up"><a href="ref.misc.html">Misc. Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.usleep" class="refentry"> <div class="refnamediv"> <h1 class="refname">usleep</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">usleep</span> — <span class="dc-title">Delay execution in microseconds</span></p> </div> <div class="refsect1 description" id="refsect1-function.usleep-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>usleep</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$micro_seconds</code></span> )</div> <p class="para rdfs-comment"> Delays program execution for the given number of micro seconds. </p> </div> <div class="refsect1 parameters" id="refsect1-function.usleep-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">micro_seconds</code></em></span> <dd> <p class="para"> Halt time in micro seconds. A micro second is one millionth of a second. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.usleep-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 changelog" id="refsect1-function.usleep-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.0.0</td> <td> This function now works on Windows systems. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.usleep-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3792"> <p><strong>Example #1 <span class="function"><strong>usleep()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">// Current time<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'h:i:s'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// wait for 2 seconds<br /></span><span style="color: #0000BB">usleep</span><span style="color: #007700">(</span><span style="color: #0000BB">2000000</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// back!<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'h:i:s'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> 11:13:28 11:13:30 </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.usleep-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.sleep.html" class="function" rel="rdfs-seeAlso">sleep()</a> - Delay execution</span></li> <li class="member"> <span class="function"><a href="function.time-nanosleep.html" class="function" rel="rdfs-seeAlso">time_nanosleep()</a> - Delay for a number of seconds and nanoseconds</span></li> <li class="member"> <span class="function"><a href="function.time-sleep-until.html" class="function" rel="rdfs-seeAlso">time_sleep_until()</a> - Make the script sleep until the specified time</span></li> <li class="member"> <span class="function"><a href="function.set-time-limit.html" class="function" rel="rdfs-seeAlso">set_time_limit()</a> - Limits the maximum execution time</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.unpack.html">unpack</a></div> <div class="next" style="text-align: right; float: right;"><a href="changelog.misc.html">Changelog</a></div> <div class="up"><a href="ref.misc.html">Misc. Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>