Replace parts of a PHP string replacing words characters
RegisterLogin
Replace parts of a PHP string replacing words characters
Post Description: Replace parts of a PHP string replacing words characters
Tags: Replace, parts, of, a, PHP, string, replacing, words, characters
This Post Was Posted On Feb 29, 2008 By web hosting #1255
Post Description: Replace parts of a PHP string replacing words characters
Tags: Replace, parts, of, a, PHP, string, replacing, words, characters
This Post Was Posted On Feb 29, 2008 By web hosting #1255
Replace parts of a PHP string replacing words characters by web hosting
lets say i have a string, the this is the value:
$string = "Wallpaperama has many screensavers you can download for free in our screensavers page"
ok, lets say i want to change all the words "screensavers" to "wallpapers" and this is how i would do it:
<?
$string = "Wallpaperama has many screensavers you can download for free in our screensavers page"
echo str_replace(('screensavers','wallpapers',$string);
?>
$string = "Wallpaperama has many screensavers you can download for free in our screensavers page"
echo str_replace(('screensavers','wallpapers',$string);
?>
with this code, i am telling php that i want to replace any part of the string that contains "screensavers" and replace it with "wallpapaers" and the ouput will be like this
Wallpaperama has many wallpapers you can download for free in our wallpapers page
this is the format to use this function:
str_replace ('find this', 'replace it with this', 'in this')
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
AYUSHDEEPSINGH
#1686 1
thanks peoples i am very happy
Mar 12, 2008 Reply Report abuse
©2011 Webune Forums - Mon Dec 19, 2011 2:12 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3