I'm using usleep
to simulate slower internet in my projects, so to have a better perception of the screens when there is loads for ajax requests for example.
Using a linux environment seems to work normal if I use:
usleep(2500);
But in Windows seems to have no effect, the delay does not occur. I know that usleep
has some problems that may vary for each processor and I even know of this alternative mentioned in the php .net # 54572 :
dl('php_w32api.dll');
$GLOBALS['win32api'] =& new win32;
// USleep alternative for Windows and PHP4:
$GLOBALS['win32api']->registerfunction("long Sleep (long dwMillisecods) From kernel32.dll");
// Now you can call the function from everywhere in your script: $GLOBALS['win32api']->Sleep(milliseconds);
for ($msec = 2000; $msec > 0; $msec = $msec - 125) {
echo "Hi. Next one in $msec msec.\n";
$GLOBALS['win32api']->Sleep($msec);
}
But where I read the problems are related to the differences in time and processor reaching 100%, but I did not find out about the "not working" function.
I'm using:
- Processor: Interl Core i5 m450 (2.40 GHz)
- PHP 5.4.12 (Thread Safety)
- x64 Architecture
- Server API: Apache 2.0 Handler
Is it a processor variation or the PHP version?