note 48066 added to function.substr-replace
| From: | danieldoorduin at hotmail dot com | Date: | Fri, 10 Dec 2004 10:48:40 +0000 |
| Subject: | note 48066 added to function.substr-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81633@lists.php.net to get a copy of this message | ||
Using substr_replace() can be avoided by using substr() instead:
<?
$string = substr($string, 0, $position_needle).$replace.substr($string,
$position_needle+$length_needle);
?>
This can be useful when you need to replace parts of multibyte strings like strings encoded with
utf-8. There isn't a multibute variant for substr_replace(), but for php substr() there is
mb_substr(). For more information on multibyte strings see http://nl3.php.net/manual/en/ref.mbstring.php
----
Manual Page -- http://www.php.net/manual/en/function.substr-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48066
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48066&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48066&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48066&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48066&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48066&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48066&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48066&report=yes
Search -- http://master.php.net/manage/user-notes.php