3

Possible Duplicate:
Does sleep time count for execution time limit?

If the max execution time lower than the sleep function argument

ini_set('max_execution_time', 30);
sleep(35);
foo();

will the foo() function run?

Is it OS specific or not?

EDIT: thank you for your answers, and for a link to a similar question: Does sleep time count for execution time limit?

Community
  • 1
  • 1
Sergey Telshevsky
  • 12,077
  • 6
  • 55
  • 78

1 Answers1

4

while setting the set_time_limit or max_execution_time the duration of sleep() will be ignored in the execution time. The following illustrates:

<?php

  set_time_limit(20);

  while ($i<=10)
{
    echo "i=$i ";
    sleep(100);
    $i++;
}

?>

Output:

i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10.

Taken from http://www.drupaluser.org/php_manual/function.set-time-limit.html

i think this may help.

noobie-php
  • 6,817
  • 15
  • 54
  • 101
  • You really get this Output after 1000 Seconds? I had to change to sleep(1) to get your result in 10 seconds even I used set_time_limit(2); – Cyborg Apr 23 '17 at 04:57