Sunday, May 29, 2011

PHP remove all characters and leave only numbers

function which will remove all but leave only numbers for php:
$string = preg_replace('#[^0-9]#','',strip_tags($string));

p.s. If you are looking for function to delete all except chars and numbers look here:
http://pilotaz.blogspot.com/2011/08/php-string-replace-all-except-numbers.html 

No comments:

Post a Comment