check special chars in php code example
Example: determine special characters in php
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}