We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

Tate on 03/18/08


Tagged


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

luman
skywalker
mb
pixelhandler


Remove any characters that are not numbers or letters


Published in: PHP 


  1. $string = "This is some text and numbers 12345 and symbols !£$%^&";
  2. $new_string = ereg_replace("[^A-Za-z0-9]", "", $string);
  3. echo $new_string

Report this snippet 

You need to login to post a comment.