note 76522 added to function.stripos
| From: | hpavonatgmaildotcom at osu1 dot php dot net | Date: | Thu, 19 Jul 2007 07:54:38 +0000 |
| Subject: | note 76522 added to function.stripos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128710@lists.php.net to get a copy of this message | ||
To shane_at_51smith-dot-nl
Fine but not useful if you want to use stripos 3rd param òffset´ for instance to find all
occurences of `needle´.
Again rchillet and heavyraptor solution is best though you'd better keep to-lowercase strings
outside the function if you're planning to loop through `haystack´ like this:
$lower_haystack = strtolower($haystack);
$lower_needle = strtolower($needle);
$offset = 0;
//... looping over haystack
while ($offset !== false) {
$offset = strpos($lower_haystack, $lower_needle, $offset);
//... some funny stuff here
}
Using rchillet-heavyraptor function here would slow down performance. Solution: don't invent
any function
----
Server IP: 130.206.1.5
Probable Submitter: 193.127.7.62
----
Manual Page -- http://www.php.net/manual/en/function.stripos.php
Edit -- https://master.php.net/note/edit/76522
Del: integrated -- https://master.php.net/note/delete/76522/integrated
Del: useless -- https://master.php.net/note/delete/76522/useless
Del: bad code -- https://master.php.net/note/delete/76522/bad+code
Del: spam -- https://master.php.net/note/delete/76522/spam
Del: non-english -- https://master.php.net/note/delete/76522/non-english
Del: in docs -- https://master.php.net/note/delete/76522/in+docs
Del: other reasons-- https://master.php.net/note/delete/76522
Reject -- https://master.php.net/note/reject/76522
Search -- https://master.php.net/manage/user-notes.php