Posted by crucialmoment on 01/31/06 14:10
Here's an example using preg_replace
$pattern[0] = '/\/';
$pattern[1] = '/\}/';
$pattern[2] = '/\$/';
$pattern[3] = "/\%/";
$replacement[0] = '{';
$replacement[1] = '}';
$replacement[2] = '$';
$replacement[3] = '%';
$myvar = preg_replace($pattern, $replacement, $myvar);
$pattern is the array of text or characters to search for.
$replacement is what to replace with
In this example, some characters are replaced with their html escape
codes
[Back to original message]
|