
January 14th, 2003, 09:35 AM
|
|
Junior Member
|
|
Join Date: Dec 2002
Location: Indonesia
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
remove space between words
first..sorry if my english is bad.
I'm a newbie in php world, sorry if this is a dummy question.
Here is the cases :
I have a variabel :
i want to change the variabel so it's become
i've tried using explode.
PHP Code:
$word="i love her"
$wordArray=explode(" ",$word);
then i'll get an array.
i use this :
PHP Code:
foreach ($wordArray as $newWord) {
$newVar=$newWord;
}
i hoped that will make a new variabel,
but it didn't work. When i checked it with , i've got only word her . I didn't have iloveher.
If i do this :
PHP Code:
foreach ($wordArray as $newWord) {
echo "$newVar";
}
i have the word : iloveher
But i don't want to echo it, i want to make it became a new variabel.
Can someone tell me how to do that ?.
Thx before.... 
|