Re: Re: exploding
| From: | Felix | Date: | Wed, 25 Aug 2004 22:57:43 +0000 |
| Subject: | Re: Re: exploding | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194740@lists.php.net to get a copy of this message | ||
Try this:
$array = explode( ' ', chunk_split( $sting, 1, ' ' ) );
http://www.php.net/manual/de/function.explode.php
http://www.php.net/manual/de/function.chunk-split.php
On Thu, 26 Aug 2004 00:50:09 +0200, Peter Brodersen <php@ter.dk> wrote:
> Hi,
>
> On Wed, 25 Aug 2004 18:00:49 -0400, in php.general
> linux@nittanytravel.com (Jake McHenry) wrote:
>
> >Hi everyone.
> >
> >Is there a way to explode by every character in the variable?
> >
> >Example:
> >
> >$var = "00008";
> >$test = explode("", $var);
>
> Use preg_split(): http://php.net/preg_split - example 2.
>
> <?php
> $var = "00008";
> $test = preg_split('//', $var,-1,PREG_SPLIT_NO_EMPTY);
> print_r($test);
> ?>
>
> Or, a possible faster method, using str_split() (only available in
> PHP5): http://php.net/str_split
>
> <?php
> $var = "00008";
> $test = str_split($var); // requires PHP5
> print_r($test);
> ?>
>
> --
> - Peter Brodersen
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>