Page 1 of 1

why sleep() not returning anything

Posted: Thu Aug 06, 2009 11:28 pm
by LeetheFIRST
Here is my code, an output of 0 is expected after sleep() suceeded, but instead nothing is printed. can anyone tell me why, please?

Code: Select all

 
<?php
      print "Hello   Web!!!";
 
      print "\n";
 
      print sleep(8);
?>
 

Re: why sleep() not returning anything

Posted: Fri Aug 07, 2009 7:09 am
by marty pain
In this case sleep should return with 0.

What do you get?

Re: why sleep() not returning anything

Posted: Fri Aug 07, 2009 7:29 am
by Mark Baker
Try

Code: Select all

print(sleep(8));
print doesn't normally need the brackets, but it may make a difference

Re: why sleep() not returning anything

Posted: Fri Aug 07, 2009 9:58 am
by pickle
try:

Code: Select all

var_dump(sleep(8));
That'll tell you exactly what's being returned

Re: why sleep() not returning anything

Posted: Sun Aug 09, 2009 6:37 pm
by LeetheFIRST
pickle wrote:try:

Code: Select all

var_dump(sleep(8));
That'll tell you exactly what's being returned
I got NULL from this. don't know why 'cause the program did sleep for 8 sec!

Re: why sleep() not returning anything

Posted: Sun Aug 09, 2009 9:05 pm
by &nbsp;
I'm not sure why you would ever want to use sleep() in an application. :P