why doesn't this work

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a PHP script, and it's bypassing a for loop:

$fy1 = $F['frame_y1'];
$fy2 = $F['frame_y2'];

 for ($y = $fy1;  $y <= $fy2;  $y++) {

on printout,  $fy1 == -5 and  $fy2 == 594
why wouldn't that work?  you can start negative and increment through 0 to a
positive number in a for loop, can't you?


Re: why doesn't this work

Quoted text here. Click to load it

Quoted text here. Click to load it

This works perfectly:
$fy1 = -5;
$fy2 = 594;
for ($y = $fy1;  $y <=3D $fy2;  $y++){
   echo 'foo';

Which leads me to believe $F['frame_y1'] & $F['frame_y2'] don't hold wha=
t  =

you think they hold. Do a var_dump() on them instead of a print, and don=
't  =

look at an HTML presentation in a browser, look at the _source_ that get=
's  =

dumped out. Someone with an equal problem some weeks ago turned out to  =

have something like '<span>12</span>' instead of '12', which will be  =

interpreted as 0 when cast to an integer, but seems OK when just echo'ed=
 &  =

viewed in a browser.
-- =

Rik Wasmus

Site Timeline