Extract Numbers from String

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

Give a string, and it will only returns numbers.

Copy this code and paste it in your HTML
  1. function extract_number($string) {
  2. return ereg_replace("[^0-9]", "", $string);
  3. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.