Home   Best Sellers   Blogging   Coding & Design   Technology   SEO   Travel & living   Career   Videos   Tips   Calculators     
Home  »     »     »  PHP function to remove all character which are not alphabets or numbers

PHP function to remove all character which are not alphabets or numbers

Wednesday, February 23, 2011



Here is the php function to remove all character which are not alphabets or numbers
to remove the white space just pass the param $removeSpace as 1

function removeNonAlphaNumero( $str , $removeSpace = 0 ){
$return_string = "";
if( trim($str) != "" ){
if($removeSpace )
$return_string = preg_replace("/[^a-zA-Z0-9]/", "", $str);
else
$return_string = preg_replace("/[^a-zA-Z0-9\s]/", "", $str);

}

return $return_string;
}










How to link to this page?
If you wish to link to this page from your website, simply Copy and paste the above HTML code to your web page. It will appear on your page as:
PHP function to remove all character which are not alphabets or numbers.




Share this!




comments powered by Disqus

This Weeks 7 Popular Posts


Subscribe to Recent Posts by Email
Stay connected to CROZOOM with regular Email notices of new Techie articles and IT Jobs. Updates will be delivered to your Inbox as soon as they are posted online.

Enter Your Email Address:  

Delivered by FeedBurner   RSS Feed

Search this Blog   



Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »