simple function to remove non numeric characters from a string with PHP


  Remove non-numeric characters from a string.
function stripNonNumeric($str='') {
  return preg_replace('(\D+)', '', $str);

Refer gist for comments

Justin Kelly

Justin Kelly

Web Developer, Business Analytics, Data Engineer specialising in PHP, ReactJS, Tableau, AWS RedShift and Matillion ETL

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly

Leave a comment

Name Notify me of replies by email.