Extract numbers from string (php)
Extract numbers from a string (remove all letters, symbols, and other characters.) Using ereg_replace, we specify that numbers 0-9 should NOT be replaced, and therefore removing letters, symbols, and everything else.
// extract numbers from a string
// http://php.snippetdb.com
$string = "The 1. Quick and 2. Brown fox said 3. (!@*(#!@*";
$new_string = ereg_replace("[^0-9]", "", $string);
echo $new_string;
output: 123