ITTreats.com
Enter your Search term and Hit "Enter"

Fri, 19 Mar 2010 5:30:02 PM +00:00

Latest 'ITTreats'


Trimming Completely using PHP Regular expressions

Trimming  Completely using PHP Regular expressions

Hello Friends,

Is your  Trimming method  is taking care for  special characters ?  you might be using  some trimming for some of the special characters but what about the rest ? for you  here is a  simple  Function which will trim  the string  entirely  and  results only the pure string

function pureTrim($input)
{
        // This allows Only   Alphabets Numerals  and Space
	$output = preg_replace("/[^a-z0-9\s]/i", " ", $input);
	$output= trim($output);
	return $output;
 
}

So, try using this function your code . Hope this will help you