Re: Re: PHP 4.0 Bug #6414 Updated: foreach() doesn't accept string for an argument
| From: | Andrei Zmievski | Date: | Tue, 29 Aug 2000 16:40:58 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #6414 Updated: foreach() doesn't accept string for an argument | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31092@lists.php.net to get a copy of this message | ||
On Tue, 29 Aug 2000, James Moore wrote:
> OK this might well be true I didnt test it.. But the manual does state
> foreach needs array inputs not string inputs, so it is not suprising that
> PHP complains when you pass it a string, I reliase that strings/arrays can
> be treated similarly, I suggest you convert it to an array using some loop..
> Maybe somthing like:
>
> for($i=0;$i<strlen($b);$i++) {
>
> $b_array[] = $b[$i]; /* You might need $b_array = substr($b,$i,1); instead
> here... */
>
> }
$letters = preg_split("//", $word);
-Andrei
Politics is for the moment, an equation is for eternity.
-- Albert Einstein