Re: Re[2]: [PHP] doing with string

From: Date: Wed, 09 Apr 2003 12:37:06 +0000
Subject: Re: Re[2]: [PHP] doing with string
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-143061@lists.php.net to get a copy of this message
$abc = "abc123efg456";
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. 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]+
<?PHP $String="1aaa98iuyiu22iodowqd290808ooo9911"; preg_match_all("/[a-z]+|[0-9]+/",$String,$PHP_code);
        for ($i=0;$i<count($PHP_code[0]);$i++)
        echo '<br>'.$i.':'.$PHP_code[0][$i];
?> make cheques payable to.....

« previous php.general (#143061) next »