php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #6772 wrong documentaion for strrchr and strrpos
Submitted: 2000-09-15 16:51 UTC Modified: 2000-10-21 13:00 UTC
From: tjabo at unix-ag dot org Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.2 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tjabo at unix-ag dot org
New email:
PHP Version: OS:

 

 [2000-09-15 16:51 UTC] tjabo at unix-ag dot org
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";
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-15 08:16 UTC] lyric@php.net
Which documentation are you using? The _body_ of the documentation for the functions you're talking about describes their return types correctly. (Yes, the one line summary is "find the last occurance of a char in a
string", which is logically correct)
 [2000-10-21 13:00 UTC] jmoore@php.net
The documentation is correct, although the one line description is slightly ambigious there is no real problem if you read the actual docs rather than the one line description.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 23 20:00:01 2026 UTC