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 and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly

Leave a comment

Notify me of replies by email.