php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67915 Improve strrchr
Submitted: 2014-08-27 14:14 UTC Modified: -
Votes:3
Avg. Score:1.7 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: contact at mathiasstrasser dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 5.6.0RC4 OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-08-27 14:14 UTC] contact at mathiasstrasser dot com
Description:
------------
Hi,

I would like to know if is that possible to add a new argument in a
function strrchr ?
To do the same things of strstr.

strrchr ( string $haystack , mixed $needle [, bool $before_needle = false
] )

before_needle
If TRUE, strrchr() returns the part of the haystack before the first
occurrence of the needle (excluding the needle).

Actually i'm forced to write:

substr ( $haystack, 0, strrpos ( $haystack, $needle ) )


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-08 10:01 UTC] mkurczew at gmail dot com
This would break SRP for PHP more than it currently is and creating yet another built-in function for this would unnecessarily pollute global namespace. Instead of complicating things more by introducing functions/arguments out of the blue, we should endeavor to simplify things. I'm against this.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 00:01:28 2019 UTC