Mega Code Archive

 
Categories / Php / Code Snippets
 

Remove all characters except letters and numbers from a string

<?php $string = "This is some text and numbers 12345 and symbols !£$%^&"; $new_string = ereg_replace("[^A-Za-z0-9]", "", $string);echo $new_string ?>