Req #39962 [Opn]: Suggestion: SUBSTR_ADD Function
| From: | arpad@php.net | Date: | Tue, 23 Aug 2011 14:28:57 +0000 |
| Subject: | Req #39962 [Opn]: Suggestion: SUBSTR_ADD Function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162856@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=39962&edit=1
ID: 39962
Updated by: arpad@php.net
Reported by: pjoe444 at hotmail dot com
Summary: Suggestion: SUBSTR_ADD Function
Status: Open
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
PHP Version: 5.2.0
Block user comment: N
Private report: N
New Comment:
substr_replace() already provides this when the length argument is 0.
Previous Comments:
------------------------------------------------------------------------
[2011-08-23 14:08:50] datibbaw@php.net
The following patch has been added/updated:
Patch Name: substr_insert.patch
Revision: 1314108530
URL: https://bugs.php.net/patch-display.php?bug=39962&patch=substr_insert.patch&revision=1314108530
------------------------------------------------------------------------
[2011-08-23 14:05:14] datibbaw@php.net
The following patch has been added/updated:
Patch Name: substr_insert.patch
Revision: 1314108314
URL: https://bugs.php.net/patch-display.php?bug=39962&patch=substr_insert.patch&revision=1314108314
------------------------------------------------------------------------
[2006-12-27 14:55:17] pjoe444 at hotmail dot com
( SUBTRACTION, on the other hand, does work simply enough with the current system:
with SUBSTR_REPLACE being able to replace a character with an empty string "" )
------------------------------------------------------------------------
[2006-12-27 14:42:30] pjoe444 at hotmail dot com
Description:
------------
SUGGESTION to the PhP Group
(I did not find any place for suggestions on the site:
the suggestion links seem to point here)
How about a SUBSTR_ADD function similar to substr_replace
substr_add (mixed string, string replacement, int start [, int length] )
example when handling time (in schedules etc)
$var=1245
$var= substr_add ($var, ':', 2);
$var value now 12:45
Yes-- you can split and add and rejoin strings, or probably use preg_replace, but I am surprised
that such a simple useful facility does not seem to be available in PHP ! :-( Thanks!
Peter Douglas
Reproduce code:
---------------
N/A
Expected result:
----------------
N/A
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=39962&edit=1