Re: converting string into array with regex
| From: | CPT John W. Holmes | Date: | Fri, 05 Dec 2003 22:01:18 +0000 |
| Subject: | Re: converting string into array with regex | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172029@lists.php.net to get a copy of this message | ||
From: "Adam i Agnieszka Gasiorowski FNORD" <agquarx@venus.ci.uw.edu.pl>
> No, no spaces between letters (otherways
> it would be very easy, indeed). So there is
> no way to match the "space between alphanumeric
> chars" and split on it? I was trying to avoid
> the loop solution.
Of course there is. In fact, this example, direct from the manual, does
exactly what you want...
<?php
$str = 'string';
$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
print_r($chars);
?>
Imagine that!---John Holmes...