What does the error message "Unknown modifier '.'" indicate in PHP?

The error message "Unknown modifier '.'" in PHP indicates that there is an issue with the regular expression pattern due to an unrecognized modifier '.'. This error commonly occurs when using the preg_replace function with an incorrect regular expression pattern. To fix this issue, you need to escape the '.' character in your regular expression pattern using a backslash '\'.

// Incorrect regular expression pattern causing "Unknown modifier '.'" error
$pattern = '/test./';

// Corrected regular expression pattern with escaped '.'
$pattern = '/test\./';