note 53834 added to ref.strings
| From: | t0russ at gmail dot com | Date: | Tue, 14 Jun 2005 17:38:26 +0000 |
| Subject: | note 53834 added to ref.strings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90425@lists.php.net to get a copy of this message | ||
to kristin at greenaple dot on dot ca:
thanx for sharing.
your function in recursive form proved to be slightly faster and it returns false (as it should)
when the character is not found instead of number 0:
<?php
function strnposr($haystack, $needle, $occurance, $pos = 0) {
return ($occurance<2)?strpos($haystack, $needle,
$pos):strnposr($haystack,$needle,$occurance-1,strpos($haystack, $needle, $pos) + 1);
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.strings.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53834
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53834&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53834&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53834&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53834&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53834&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53834&report=yes
Search -- http://master.php.net/manage/user-notes.php