note 69089 deleted from function.strpos by bjori
| From: | bjori@php.net | Date: | Wed, 23 Aug 2006 07:37:22 +0000 |
| Subject: | note 69089 deleted from function.strpos by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116204@lists.php.net to get a copy of this message | ||
Note Submitter: gabriel at artsanddesignsjapan dot com
----
dorphalsig's code is buggy and will cause an infinite loop. Here's a version that actually
works:
<?php
function strposarray($haystack,$needles,$offset=0) {
$pos = false;
$i = 0;
$m = count($needles);
while($pos===false && $i<$m) {
$pos = strpos($haystack,$needles[$i],$offset);
$i++;
}
return $pos;
}
?>