Hướng dẫn replacing string in php
(PHP 4, PHP 5, PHP 7, PHP 8) substr_replace — Replace text within a portion of a string Descriptionsubstr_replace( Parametersstring The input string. An array of
strings can be provided, in which case the replacements will occur on each string in turn. In this case, the replace The replacement string. offset If If length If given and is positive, it represents the length of the portion of Return Values The result string is returned. If Changelog
ExamplesExample #1 Simple substr_replace() examples
Example #2 Using substr_replace() to replace multiple strings at once
The above example will output: A: YYY; B: YYY; C: YYY A: AAA; B: BBB; C: CCC A: AAAXX; B: BBBX; C: CCC Notes
See Also
elloromtz at gmail dot com ¶ 12 years ago
billg AT microsoft.com ¶ 13 years ago
$start < 0) eblejr AT phrebh DOT com ¶ 14 years ago
juichenieder-phnet at yahoo dot co dot uk ¶ 13 years ago
ivijan dot stefan at gmail dot com ¶ 8 years ago
danieldoorduin at hotmail dot com ¶ 17 years ago
William Barry ¶ 14 years ago
// Find the first closing ul kalim dot fleet at gmail dot com ¶ 12 years ago
= 'abcdefghijklmnopqrstuvwxyz0123456789z.jpg'; klaas at group94 dot com ¶ 20 years ago
mrbrown8 at juno dot com ¶ 21 years ago
Hayley Watson ¶ 5 years ago
alishahnovin at hotmail dot com ¶ 15 years ago
hermes at andycostell dot com ¶ 17 years ago
den dot gierling at web dot de ¶ 12 years ago
Guru Evi ¶ 17 years ago
shaman_master at list dot ru ¶ 2 years ago
bkline at rksystems dot com ¶ 3 years ago
meg dot phillips91 at gmail dot com ¶ 2 years ago
yeyijelud at amadamus dot com ¶ 3 years ago
NiX0n at fragfest dot cx ¶ 13 years ago
spcl dot delivery at gmail dot com ¶ 14 years ago
jaimthorn at yahoo dot com ¶ 14 years ago
chuayw2000 at hotmail dot com ¶ 16 years ago
Thijs Wijnmaalen (thijs[at]nllinux.nl) ¶ 18 years ago
strlen($text) > $maxChars) { david at ethinkn dot com ¶ 19 years ago
truncate ('akfhslakdhglksjdgh', 10, '...'); nospam at nospam dot com ¶ 6 years ago
strShorten('123456789', 6, ''); // outputs 123789 dmron ¶ 18 years ago
Anonymous ¶ 21 years ago
blessador at gmail dot com ¶ 9 years ago
at the end of substr_replace ($price, ',', -3, 0)" in the above code to avoid error.
tony at outshine dot com ¶ 18 years ago
geniusdex ( at ) brz ( dot ) nu ¶ 18 years ago
ntoniazzi at sqli dot com ¶ 14 years ago
thomasNOSPAM at sportentranceNOSPAM dot com ¶ 19 years ago
olav at schettler dot net ¶ 6 years ago
admiral at nuclearpixel dot com ¶ 12 years ago
admiralsTruncate($my_string, 6); // outputs: cfcd20echo ' |