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

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 s

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 fe

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, > str_rep

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]"; } http://us.php.net/manual/en/func

[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 Code=

Re: [PHP] Removing Spaces

2003-07-30 Thread John W. Holmes
Jason Williard wrote: In parsing a file, I ended up with a number of variables that include spaces. Is there an easy way to remove a space from a variable? $new_string = str_replace(' ','',$old_string); ? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Archite

[PHP] Removing Spaces

2003-07-30 Thread Jason Williard
In parsing a file, I ended up with a number of variables that include spaces. Is there an easy way to remove a space from a variable? Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Removing spaces from a string

2001-01-11 Thread Monte Ohrt
$string = preg_replace("/\s+/","" $string); That will get spaces as well as special chars like \t,\n,\r and \f Ray Iftikhar wrote: > > How would I go about removing the space from a string? > (ie. 3 doors down -> 3doorsdown) > Last I checked I dont think that there was a specific function for