Filter allowed chars via PHP
Jump to navigation
Jump to search
To sanitize user input in webforms, i.e. to get rid of all non-number chars in a telephone input field:
$phone = preg_replace("/[^0-9]+/", "", $phone);
Which leaves only numbers intact.