Remove everything but numbers from a string


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

Make it $new_string = ereg_replace("[^A-Za-z0-9]", "", $string );


Copy this code and paste it in your HTML
  1. $string = "(032)555-5555";
  2. $new_string = ereg_replace("[^0-9]", "", $string );
  3. echo $new_string;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.