PHP - Remove all non-numeric characters


/ Published in: PHP
Save to your folder(s)

Sometimes it’s helpful to ONLY get numeric characters.
Phone numbers, age — whatever your little PHP heart desires.


Copy this code and paste it in your HTML
  1. $strNumeric = preg_replace('/\D/', '', $strNonNumeric);

URL: http://www.crainbandy.com/programming/function-to-remove-all-non-numeric-characters-in-php

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.