I found this few lines of PHP script useful to sanitize user input, it removes characters except numbers and letters:
$clean_code = preg_replace('/[^\w]/', '', $string);
Or this one:
$clean_code = preg_replace('/[^a-zA-Z0-9]/', '', $string);
Original post is here: https://coderwall.com/p/bn47ka/remove-all-characters-except-letters-and-numbers-in-php
loading...