How to remove any characters that do not match [a-z][A-Z][0-9] in string using PHP

1 Answer

0 votes
$string = "php! c (062) c++ *java*";

$string = preg_replace("/[^a-zA-Z0-9]/", "", $string);

echo $string;
 
 
 
 
/*
run:
 
phpc062cjava

*/
 

 



answered Dec 4, 2023 by avibootz
...