Source Code:
(back to article)
<?php $string = "Hello 123 World 456"; $string = preg_replace('/[^0-9]/', '', $string); echo $string; // Output: "123456"
Result:
Report an issue