PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
LeetheFIRST
Forum Newbie
Posts: 2 Joined: Thu Aug 06, 2009 11:22 pm
Post
by LeetheFIRST » Thu Aug 06, 2009 11:28 pm
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);
?>
marty pain
Forum Contributor
Posts: 105 Joined: Thu Jun 11, 2009 5:32 am
Location: Essex
Post
by marty pain » Fri Aug 07, 2009 7:09 am
In this case sleep should return with 0.
What do you get?
Mark Baker
Forum Regular
Posts: 710 Joined: Thu Oct 30, 2008 6:24 pm
Post
by Mark Baker » Fri Aug 07, 2009 7:29 am
Try
print doesn't normally need the brackets, but it may make a difference
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Fri Aug 07, 2009 9:58 am
try:
That'll tell you exactly what's being returned
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
LeetheFIRST
Forum Newbie
Posts: 2 Joined: Thu Aug 06, 2009 11:22 pm
Post
by LeetheFIRST » Sun Aug 09, 2009 6:37 pm
pickle wrote: try:
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!
Forum Newbie
Posts: 2 Joined: Sun Aug 09, 2009 9:00 pm
Location: Colorado, USA
Post
by » Sun Aug 09, 2009 9:05 pm
I'm not sure why you would ever want to use sleep() in an application.