Re: string to array
| From: | HiTCHO) | Date: | Fri, 08 Nov 2002 13:20:05 +0000 |
| Subject: | Re: string to array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123371@lists.php.net to get a copy of this message | ||
That won't work.. empty delimiter errors always.. you will have to use
my preg one from earlier...
Timothy Hitchens (HiTCHO)
tim@hitcho.com.au
If you need PHP hosting with an experienced
support team 24/7 then email me today.
On Fri, 8 Nov 2002, Erwin wrote:
> Tom Rogers wrote:
> > Hi,
> >
> > Friday, November 8, 2002, 10:43:10 PM, you wrote:
> >> Hi all,
> >
> >> has anyone an elegant (and faster) way of converting 'string' to
> >>
> >> array('s','t','r','i','n','g'), other
> >> then
> >> for($i=0; $i<strlen($string); $i++) $array[$i]=$string[$i];
> >
> >
> >
> > A string is already an array of chars
> >
> > $string = 'string';
> > echo $string[0]; // will echo 's'
>
> True, but that's different than the array type. Sometimes you'll just need
> an array instead of a string.
>
> Try using
>
> $string = explode( '', 'string' );
>
> Grtz Erwin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>