note 81335 added to function.substr

From: Date: Sat, 23 Feb 2008 01:12:03 +0000
Subject: note 81335 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-136424@lists.php.net to get a copy of this message
I've used the between, after, before, etc functions that biohazard put together for years and they work great. I've also added to it a new function that I use a lot and thought others might like it as well. It uses his before/after functions so they are required to use it. <? $example_html = "<p>test1 Test2</p><title>hi there</title><p>Testing</p>"; $paragraph_text = multi_between('<p>', '</p>', $example_html); //Prints an arry of: //Array ( [1] => test1 Test2 [2] => Testing ) print_r($paragraph_text); function multi_between($this, $that, $inthat) { $counter = 0; while ($inthat) { $counter++; $elements[$counter] = before($that, $inthat); $elements[$counter] = after($this, $elements[$counter]); $inthat = after($that, $inthat); } return $elements; } //Get the help functions from biohazard's post below. ?> ---- Server IP: 217.160.72.57 Probable Submitter: 71.218.136.158 ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- https://master.php.net/note/edit/81335 Del: integrated -- https://master.php.net/note/delete/81335/integrated Del: useless -- https://master.php.net/note/delete/81335/useless Del: bad code -- https://master.php.net/note/delete/81335/bad+code Del: spam -- https://master.php.net/note/delete/81335/spam Del: non-english -- https://master.php.net/note/delete/81335/non-english Del: in docs -- https://master.php.net/note/delete/81335/in+docs Del: other reasons-- https://master.php.net/note/delete/81335 Reject -- https://master.php.net/note/reject/81335 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136424) next »