Re: [PHP] Removing Spaces from Array Values

2007-07-03 Thread Jim Lucas
kvigor wrote: Need to remove all spaces from Array Values... And this doesn't work. Are we talking spaces ' ' or all white space? This may include a tab, space, new line, etc... This is similar info that's within array values: $someArray[0] = PHP is awesome;s/b PHPisawesome This is

Re: [PHP] Removing Spaces from Array Values

2007-07-03 Thread Arpad Ray
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

[PHP] Removing Spaces from Array Values

2007-07-02 Thread kvigor
Need to remove all spaces from Array Values... And this doesn't work. This is similar info that's within array values: $someArray[0] = PHP is awesome;s/b PHPisawesome This is similar info that's within array values: $someArray[1] = The Toy Boat;s/b TheToyBoat Begin

Re: [PHP] Removing Spaces from Array Values

2007-07-02 Thread Adam Schroeder
The function str_replace() DOES NOT change the parameter. Rather, str_replace() returns the desired string. Try changing your code to: for($num = 0; $cntr $num; $cntr++) { $someArray[$num] = str_replace(' ','',$someArray[$num]); echo $someArray[$num]br /; }

Re: [PHP] Removing Spaces from Array Values

2007-07-02 Thread kvigor
Got I'm my bad I really feel SHEEPISH... s/b have done '$someArray =' Re-read what I thought I read a it worked like a dream. Thanks Adam Adam Schroeder [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The function str_replace() DOES NOT change the parameter. Rather,

Re: [PHP] Removing Spaces from Array Values

2007-07-02 Thread kvigor
I meant to say: Got It, My bad, I really feel SHEEPISH... should have done... This is what happens when you're trying to code with a migraine, You start speaking another language. Thanks Again kvigor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Got I'm my bad I really feel