Replace All Characters In a String that Aren’t Alphanumeric In PHP

Using the preg_replace function you can easily replace all characters in a string that are not alphanumeric. This can be useful for sanitizing a string or user input.

Leave a Reply

Your email address will not be published. Required fields are marked *