note 70394 added to function.strpos

From: Date: Sat, 14 Oct 2006 17:58:24 +0000
Subject: note 70394 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-118527@lists.php.net to get a copy of this message
if you want to get the position of a substring relative to a substring of your string, BUT in REVERSE way: <?php function strpos_reverse_way($string,$charToFind,$relativeChar) { // $relativePos = strpos($string,$relativeChar); $searchPos = $relativePos; $searchChar = ''; // while ($searchChar != $charToFind) { $newPos = $searchPos-1; $searchChar = substr($string,$newPos,strlen($charToFind)); $searchPos = $newPos; } // if (!empty($searchChar)) { // return $searchPos; return TRUE; } else { return FALSE; } // } ?> ---- Server IP: 212.93.155.36 Probable Submitter: 193.254.43.183 ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- https://master.php.net/note/edit/70394 Del: integrated -- https://master.php.net/note/delete/70394/integrated Del: useless -- https://master.php.net/note/delete/70394/useless Del: bad code -- https://master.php.net/note/delete/70394/bad+code Del: spam -- https://master.php.net/note/delete/70394/spam Del: non-english -- https://master.php.net/note/delete/70394/non-english Del: in docs -- https://master.php.net/note/delete/70394/in+docs Del: other reasons-- https://master.php.net/note/delete/70394 Reject -- https://master.php.net/note/reject/70394 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#118527) next »