|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-12-27 14:42 UTC] 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
Patchessubstr_insert.patch (last revision 2011-08-23 15:37 UTC by datibbaw@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
Closing this, as it can be easily done with substr_replace() already: $var = substr_replace($var, ':', 2, 0); Doesn't make much sense to add an extra function for this.