PHP str_replace - find and replace part of a string

basic usage for the str_replace php function

str_replace ( mixed $search , mixed $replace , mixed $subject)


$string = "hi there i am a string";
$to_find = "a string";
$to_replace = "a replaced string";
$result = str_replace ( $search = $to_find , $replace = $to_replace , $subject = $string);
echo $result;


hi there i am a replaced string

Other Items in php
Page Views

This page has been viewed 72 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.