Re: Removing Spaces from Array Values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 />";
}



http://us.php.net/manual/en/function.str-replace.php


Adam

kvigor wrote:

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===================================
$num = count($someArray);

for($num = 0; $cntr < $num; $cntr++)
{
str_replace(' ','',$someArray[$num]);
echo "$someArray[$num]<br />";
}
End Code===================================

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux