According to the PHP manual:
[FONT=courier new]If matches are found, the new subject will be returned, otherwise subject will be returned unchanged.[/FONT]
Read more about the function at: http://www.php.net/manual/en/function.preg-replace.php .
If you want to know if anything was replaced, I guess you can match the two string to each other, if they're the same, nothing has changed, otherwise it has..
$subject1 = "abcdefabcdef";
$subject1 = "klmnopklmnop";
$replacement = Array('A', 'B', 'C');
$pattern = Array('a', 'b', 'c');
$result1 = preg_replace($pattern, $replacement, $subject1);
$result2 = preg_replace($pattern, $replacement, $subject2);
if ($subject1 != $result1) {
echo "subject1: replaced\n";
} else {
echo "subject1: no replace\n";
}
if ($subject2 != $result2) {
echo "subject2: replaced\n";
} else {
echo "subject2: no replace\n";
}
this ought to generate the output:
[FONT=courier new]subject1: replaced
subject2: no replace[/FONT]
(sorry if the code above is incorrected or misspelled or what ever, my host is down right now, so I can't verify it..)
Good luck,
Olle