General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 14th, 2003, 09:35 AM
aprian aprian is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Indonesia
Posts: 2 aprian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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 :
PHP Code:
 $word="i love her"


i want to change the variabel so it's become
PHP Code:
 $word="iloveher"


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,
PHP Code:
 $newVar="iloveher"

but it didn't work. When i checked it with
PHP Code:
echo "$newVar"
, 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....

Reply With Quote
  #2  
Old January 14th, 2003, 10:15 AM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 12
PHP Code:
 $word="i love her";
$word str_replace' '''$word ); 

That will replace the spaces or whitespace in the string with nothing...
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #3  
Old January 14th, 2003, 03:55 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 12
In reply to this,...

what If I had a string,.. "alabama florida"

how can I make the first letter in each word a Capitol letter.

I know about strtoupper and strtolower. But all I want is the first letter.
__________________
-- Jason

Reply With Quote
  #4  
Old January 14th, 2003, 04:32 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 12
Thats a hard one ()
PHP Code:
 $string 'alabama florida';
echo 
ucfirst$string ); 

Reply With Quote
  #5  
Old January 14th, 2003, 04:52 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 12
hahaha,....it's all about knowing the functions Thanks jpenn

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > remove space between words


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap