Remove Non-Alphanumeric Characters using php

This Tutorial Has Been Viewed 2,271 Times.

This is a very simple code to remove non alphanumeric charecters from a variable using php.

THE CODE

< ?php
$str = "Here! are some numbers 1244 and some non alphanumeric charecters !£$%^&";
$new_string = preg_replace("/[^a-zA-Z0-9\s]/", "", $str);
echo $new_string;
?>

This was a very quick info i just need to update on my website thanks a lot….

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Incoming search terms:





You will also be interested in ,

Tags: ,

Leave a Reply

Spam protection by WP Captcha-Free

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks
More in PHP, scripts (77 of 150 articles)


Some times the AddHandler application/x-httpd-php .php .htm .html .my whatever if you put this in .htaccess file or in HTTPD.conf ...