note 84429 deleted from function.preg-split by danbrown

From: Date: Wed, 27 May 2009 13:49:13 +0000
Subject: note 84429 deleted from function.preg-split by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156065@lists.php.net to get a copy of this message
Note Submitter: harrismw at ids dot org dot au ---- So, after posting that last post, I actually went and made it more robust. <?php /* @param $pat1 the first pattern @param $pat2 the second pattern @param $co string containing what you want to extract and delimiters @return $ite the text between the two patterns */ function getitem($pat1,$pat2,$co) { $arrayf = preg_split ($pat1, $co); $ite = $arrayf[1]; $arrayf = preg_split ($pat2, $ite); $ite = $arrayf[0]; return $ite; } ?> Yeah, so the previous post could be rendered more succinct, and it allows you to have as many delimiters as you want.

« previous php.notes (#156065) next »