note 89730 deleted from function.preg-split by danbrown
| From: | danbrown@php.net | Date: | Fri, 20 Mar 2009 18:01:15 +0000 |
| Subject: | note 89730 deleted from function.preg-split by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152217@lists.php.net to get a copy of this message | ||
Note Submitter: coyote
----
I response to the post of "csaba at alum dot mit dot edu"
You can make 2 times faster the same thing with this script:
// encapsulating of all asterix not escaped
$string=strtr($string,array('\\*'=>'\\*','*'=>'[*]'));
// exploding on all asterix not escaped (now encapsulated by [] )
$aPieces = explode('[*]',$string);
// unescaping can be safely done on each piece
$aPieces=str_replace('\\','',$aPieces);