How can PHP be used to prevent automatic conversion of special characters like 'Ǎ' to their HTML equivalents?

When special characters like 'Ǎ' are automatically converted to their HTML equivalents, it can lead to unexpected behavior in the output of a PHP script. To prevent this conversion, you can use the htmlspecialchars function in PHP. This function will encode special characters in a string so that they are displayed correctly in HTML without being converted.

$text = 'Special character: Ǎ';
echo htmlspecialchars($text, ENT_QUOTES, 'UTF-8');