Posted By

satie83 on 07/20/12


Tagged

php numbers String characters


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

DanielLucia
tux-world


PHP - Remove all non-numeric characters


 / Published in: PHP
 

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

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

  1. $strNumeric = preg_replace('/\D/', '', $strNonNumeric);

Report this snippet  

You need to login to post a comment.