Re: Convert a string to an array
| From: | Andrew Brampton | Date: | Wed, 23 Oct 2002 15:15:33 +0000 |
| Subject: | Re: Convert a string to an array | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121111@lists.php.net to get a copy of this message | ||
Shouldn't it be
for($count=0;$count<strlen($word);$count++)
{
$w[$count] = substr($word, $count, 1);
}
This should work
Andrew
"WANDA HANSEN" <scriptsjoint@earthlink.net> wrote in message
news:20021023143843.30796.qmail@pb1.pair.com...
> Hello,
>
> I am having trouble converting a string to an array.
>
> I have been trying the following:
> $len = strlen($word);
> for($count=0;$count<$len;$count++)
> {
> $w[$z] = $word{$z};
> }
>
> It appears to create an array, but when I try and shuffle it
>
> $w=shuffle($w);
>
> I get the following error:
>
> Warning: Cannot use a scalar value as an array in
> /home/taylor94/public_html/jumble/stringshuffle.php on line 68
>
> Any help would be appreciated.
>
> Thanks,
> Wanda
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>