note 71808 deleted from function.explode by tularis

From: Date: Mon, 27 Oct 2008 13:07:23 +0000
Subject: note 71808 deleted from function.explode by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145828@lists.php.net to get a copy of this message
Note Submitter: orlandu96 at gmail dot com ---- A 'between' function that we've all been waiting for. I am not savvy with regex so I resorted to explode(); <?php function between($beg, $end, $str) { $a = explode($beg, $str, 2); $b = explode($end, $a[1]); return $beg . $b[0] . $end; } echo between('<a>', '</a>', 'fsdfsdfsd<a>fsdfsd<a><a></a>sdfsdfsdf') //<a>fsdfsd<a><a></a> ?>

« previous php.notes (#145828) next »