note 67808 deleted from function.strpos by danbrown

From: Date: Sun, 17 May 2009 16:35:31 +0000
Subject: note 67808 deleted from function.strpos by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154855@lists.php.net to get a copy of this message
Note Submitter: steve at webcommons dot biz ---- If you're wanting a simple "strpos" using a pattern and don't need the complexity of multi_strpos below, this function (for PHP 4.3.0+) returns the regex position. function preg_pos($sPattern, $sSubject, &$FoundString, $iOffset = 0) { $FoundString = NULL; if (preg_match($sPattern, $sSubject, $aMatches, PREG_OFFSET_CAPTURE, $iOffset) > 0) { $FoundString = $aMatches[0][0]; return $aMatches[0][1]; } else { return FALSE; } } It also returns the actual string found using the pattern, via $FoundString.

« previous php.notes (#154855) next »