Source Code:
(back to article)
<?php function keep_alphanumeric($string) { return preg_replace("/[^a-zA-Z0-9]/", "", $string); } echo keep_alphanumeric("Hello, World! 123") . PHP_EOL; // Outputs "HelloWorld123" echo keep_alphanumeric("Fo0-BaR"); // Outputs "Fo0BaR"
Result:
Report an issue