Posted By

traeregan on 09/17/10


Tagged

regex php numeric


Versions (?)

Remove Non Numeric Characters


 / Published in: PHP
 

  1. function remove_non_numeric($string)
  2. {
  3. return preg_replace('/\D/', '', $string)
  4. }
  5.  
  6. // OR
  7.  
  8. $result = ereg_replace( '[^0-9]+', '', $source );

Report this snippet  

You need to login to post a comment.