Hi,

On Wed, 25 Aug 2004 18:00:49 -0400, in php.general
[EMAIL PROTECTED] (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

Reply via email to