Here I ran into a problem: For example, there is such code:

<meta name="description" content="<?php echo $description_text ?>"> 

If the $description_text variable has the symbol " , then, of course, incorrect output occurs. I see only one solution: before displaying $ description_text, проверять переменную на наличие символа ` проверять переменную на наличие символа and put a slash ( \ ) before it. Is there any other way out?

1 answer 1

Removed comments links

The following functions may be useful to you:

htmlspecialchars :

(PHP 4, PHP 5)
htmlspecialchars - Converts special characters to HTML entities

htmlentities :

(PHP 4, PHP 5)
htmlentities - Converts all possible characters into corresponding HTML entities.

addslashes :

(PHP 3, PHP 4, PHP 5)
addslashes - Escapes special characters in the string.