Req #67915 [Opn->Wfx]: Improve strrchr
Edit report at https://bugs.php.net/bug.php?id=67915&edit=1
ID: 67915
Updated by: cmb@php.net
Reported by: contact at mathiasstrasser dot com
Summary: Improve strrchr
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
Operating System: All
PHP Version: 5.6.0RC4
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> Actually i'm forced to write:
>
> substr ( $haystack, 0, strrpos ( $haystack, $needle ) )
Given that this use case isn't the most common, this isn't that
bad. If you need this often, consider to wrap it in a function.
> This would break SRP for PHP more than it currently is [â¦]
That.
Previous Comments:
------------------------------------------------------------------------
[2014-09-08 10:01:26] 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.
------------------------------------------------------------------------
[2014-08-27 14:14:31] 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 ) )
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67915&edit=1
Thread (3 messages)