php string special characters code example
Example 1: determine special characters in php
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}
Example 2: html special characters php
$string = "This is testing message "ETC" ";
htmlspecialchars($string, ENT_COMPAT)