PHP 4.0 Bug #6772: wrong documentaion for strrchr and strrpos
| From: | tjabo at unix-ag dot org | Date: | Fri, 15 Sep 2000 20:51:05 +0000 |
| Subject: | PHP 4.0 Bug #6772: wrong documentaion for strrchr and strrpos | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33327@lists.php.net to get a copy of this message | ||
From: tjabo@unix-ag.org
Operating system: Linux
PHP version: 4.0.2
PHP Bug Type: Documentation problem
Bug description: wrong documentaion for strrchr and strrpos
I haven't found this topic in the bug database.
the docs say, both strrpos and strrchr "find the last occurance of a char in a string".
thats wrong.
- strrpos finds the last occurance of a string in a string, and returns the position.
- strrchr finds the last occurance of a string in a string, and returns the string from the position
up to the end.
Testprogram:
<h1>strrchr() / strrpos()</h2>
<?
# sttrchr/strrpos documentation bug
# testprogram
# Author: tjabo@unix-ag.org
$haystack = "bla.deoa.se_blah.deschnorg";
$needle = ".de";
$needle2 = 'o';
print "Haystack = $haystack<br>\n";
print "Needle = $needle<br>\n";
print "strrchr: " . strrchr($haystack, $needle) . "<br>\n";
print "strrpos: " . strrpos($haystack, $needle) . ":" .
substr($haystack,strrpos($haystack, $needle),strlen($needle)) . "<br>\n";
?>