note 10710 deleted from control-structures.foreach by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 19:25:15 +0000 |
| Subject: | note 10710 deleted from control-structures.foreach by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25243@lists.php.net to get a copy of this message | ||
Note that you cannot use a string as an argument for foreach, even though you can access individual
characters in a string LIKE a zero-based array.
So instead of using foreach, try:
$str='This is a string';
$x=0;
while($str[$x]!=''){
echo $str[$x].'<br>';
$x++;
}
/* This will output
T
h
i
s
i
s
a
s
t
r
i
n
g
*/