Jim Lucas wrote:
foreach ( $someArray AS $k => $v ) {
$someArray[$k] = preg_replace('!\s!', '', $v); // Removes white
space ' ', \n, \r\n, etc...
$someArray[$k] = str_replace(' ', '', $v); // Removes only spaces
}
str_replace() also operates on arrays so there's no need for the loop:
$someArray = str_replace(' ', '', $someArray);
And if you want to replace all whitespace:
$space = array(' ', "\t", "\n", "\r", "\x0B", "\x0C");
$someArray = str_replace($space, '', $someArray);
Arpad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php