note 84429 added to function.preg-split

From: Date: Mon, 14 Jul 2008 09:45:08 +0000
Subject: note 84429 added to function.preg-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-141472@lists.php.net to get a copy of this message
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. ---- Server IP: 194.153.94.10 Probable Submitter: 144.85.223.186 ---- Manual Page -- http://www.php.net/manual/en/function.preg-split.php Edit -- https://master.php.net/note/edit/84429 Del: integrated -- https://master.php.net/note/delete/84429/integrated Del: useless -- https://master.php.net/note/delete/84429/useless Del: bad code -- https://master.php.net/note/delete/84429/bad+code Del: spam -- https://master.php.net/note/delete/84429/spam Del: non-english -- https://master.php.net/note/delete/84429/non-english Del: in docs -- https://master.php.net/note/delete/84429/in+docs Del: other reasons-- https://master.php.net/note/delete/84429 Reject -- https://master.php.net/note/reject/84429 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141472) next »