Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

for($i=0;$i<100;$i++) error

Status
Not open for further replies.

fireburner69

Programmer
Aug 22, 2002
108
0
0
GR
Does anyone know why the server will thing that 100 is not a number?
and the loop will go on forever?
It must be a conf or something! But where is that?
 
What error are you getting?

Remember with PHP, if you get a parse error at line X, that does not mean that that's where the error exists. It means that's the point at which PHP realized it was confused. The actual error can be many lines previous in your script.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Well there is no error!!!
Just when I loop with that way! the loop goes on with out stopping!

Its like it does not understand that the 100 is an integer!

but if i do this 99+1 then it will loop only 100times and stop!

But there is no error in the scripts!

Any ideas?
 
so, what you are saying, is that:

This does work for you:
Code:
for($i=0; $i < 99 + 1; $i++) 
 {
  echo $i;
 }

This does not work for you:
Code:
for($i=0; $i < 100; $i++) 
 {
  echo $i;
 }

Olav Alexander Mjelde
Admin & Webmaster
 
Believe it or not! But yeah!


I know I freaked out when I noticed but! It does happen!
 
Just a question that might help someone else. Did you try and do other things with the number 100? Like:

$n = 0;
while($n < 100) {
$n++;
}
echo "Loop ended successfully.";
 
post some (small) code that illustrates the problem please
 
yup, we all wanna look at ur code...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top