Home and Learn: PHP Programming Course
The str_replace() function in PHP allows you to replace one string with another. The syntaxt is:
str_replace( $look_for, $change_to, $search_text, match_count );
The last one, match_count, is optional. It's counts how many matches it has found.
In the example below, we're looking for "explore" and want to replace it with "explode".
$search_text = "The explore function";
$look_for = "explore";
$change_to = "explode";
print $search_text . "<BR>";
$changed_text = str_replace($look_for, $change_to, $search_text);
print $changed_text;
So you're looking for one string in the search text, and replacing it with another.
<-- Back One Page | Move on to the Next Part -->
Email us: enquiry at homeandlearn.co.uk