note 79930 added to function.substr

From: Date: Thu, 20 Dec 2007 01:24:36 +0000
Subject: note 79930 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-133800@lists.php.net to get a copy of this message
I made a function that extract data between characters. <?php $str = "<b>Bold Text 1</b><b>Bold Text 2</b>"; $boldedText = between("<b>", "</b>", $str); print_r($boldedText); function between($start, $end, $source) { while ($s != strlen($start)) { $s = strpos($source, $start, $s) + strlen($start); if ($s == strlen($start)) continue; $r[] = substr($source, $s, strpos($source, $end, $s) - $s); } return (count($r) <= 1 ? $r[0] : $r); } ?> ---- Server IP: 203.16.234.90 Probable Submitter: 121.79.13.173 ---- Manual Page -- http://www.php.net/manual/en/function.substr.php Edit -- https://master.php.net/note/edit/79930 Del: integrated -- https://master.php.net/note/delete/79930/integrated Del: useless -- https://master.php.net/note/delete/79930/useless Del: bad code -- https://master.php.net/note/delete/79930/bad+code Del: spam -- https://master.php.net/note/delete/79930/spam Del: non-english -- https://master.php.net/note/delete/79930/non-english Del: in docs -- https://master.php.net/note/delete/79930/in+docs Del: other reasons-- https://master.php.net/note/delete/79930 Reject -- https://master.php.net/note/reject/79930 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#133800) next »