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
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
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
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
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
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=
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
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
$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
9 matches
Mail list logo