Posts Tagged ‘ php function

PHP function to remove whitespaces from a string

Usage :

$spaceRemovedString = removeWhiteSpaces($stringWithSpace);

 

Function :

function removeWhiteSpaces($spaceStr)
{
	$newStr = preg_replace('/\s+/', '', $spaceStr);
	return $newStr;
}