Re: Re[2]: [PHP] doing with string
| From: | Chris Hayes | Date: | Wed, 09 Apr 2003 12:12:56 +0000 |
| Subject: | Re: Re[2]: [PHP] doing with string | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143057@lists.php.net to get a copy of this message | ||
even though it does not fit the requirements anymore, some changes in this code:
Untested... $abc = "abc123efg456"; $bits = array(); for ($x = 3; $x <= strlen($abc); $x = $x+3) for ($x = 0; $x <= strlen($abc); $x += 3)
{$bits[] = substr($abc,0,$x); $bits[] = substr($abc,$x,3);
for regular expressions, maybe you can make an r.e. that requires either a string of letters, OR a string of numbers. like $pattern=[a-z]+|[0-9]+}Yes it could work if there always were triplets in the string. But there may be for example "a123ef456". There must by some kind of regular expression in it.