Doc #66563 [Opn->Csd]: strrchr ignores offset parameter

From: Date: Sun, 01 Mar 2020 22:16:09 +0000
Subject: Doc #66563 [Opn->Csd]: strrchr ignores offset parameter
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17351@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66563&edit=1 ID: 66563 Updated by: cmb@php.net Reported by: myselfasunder at gmail dot com Summary: strrchr ignores offset parameter -Status: Open +Status: Closed Type: Documentation Problem Package: Strings related Operating System: OS X 10.9.1 PHP Version: 5.4.24 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Well, the respective documentation has been improved a while ago, so I think this ticket can be closed. Previous Comments: ------------------------------------------------------------------------ [2015-04-12 20:44:45] cmb@php.net Related To: Bug #64861 ------------------------------------------------------------------------ [2014-01-24 01:55:47] myselfasunder at gmail dot com Confirmed. Thank you. ------------------------------------------------------------------------ [2014-01-23 23:19:27] requinix@php.net The offset controls the start or end point for the search: positive offset is the ending point, negative offset is the starting point (from the end). So $offset=5 means to search from the end towards the beginning as usual but to stop at offset 5, and $offset=-5 means to search from offset ending-5 to the beginning. According to that, the documentation should be changed to read like >offset -> If specified, search will start this number of characters counted from the +> If specified, search will end this number of characters counted from the > beginning of the string. If the value is negative, search will instead start > from that many characters from the end of the string, searching backwards. ------------------------------------------------------------------------ [2014-01-23 22:32:01] myselfasunder at gmail dot com Description: ------------ The documentation indicates that the offset describes the number of characters from the front of the string, and that the search will -start- at the offset and move toward the beginning. However, the offset seems to be ignored. Test script: --------------- $buffer = '01234567890123456789'; var_dump(strrpos($buffer, '0', 5)); Expected result: ---------------- int(0) Actual result: -------------- int(10) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66563&edit=1

« previous php.doc.bugs (#17351) next »