echo?
| From: | Jim Giner | Date: | Tue, 22 Mar 2011 22:22:07 +0000 |
| Subject: | echo? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-311986@lists.php.net to get a copy of this message | ||
Kinda new to this, but I've been puttering/writing for about 3 weeks now and
have some good working screens up. Ran into something new while I was
debuggina script today.
Tried to echo the $i value within a for loop as part of the list of items I
was building
Something like
for ($i=0;$i<$rows;$i++)
echo $i.' '.$row['itemname'];
I expected to see :
1 item1
2 item2
...
...
but instead I got
1 item1
f item2
Yes - an 'f' and not a 2.
Tried it some more with this:
for ($i=1;$i<10;$i++)
echo $i." item".'<br>';
and got
c item
d item
e item
f item
g item
....
and so on.
It seems that I can only output the value of $i if I output a string in
front of it
echo ' '.$i;
works fine but
echo $i;
does not.
Any ideas?