Space after each letter in a word.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Space after each letter in a word.

Post by nickman013 »

Hello,

I would like to make a word have a space inbetween each letter.

example:

Hello -> H e l l o

thank you!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

[feyd@home]>php -r "$a = 'Hello'; echo implode(' ',preg_split('##',$a,-1,PREG_SPLIT_NO_EMPTY));
H e l l o
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

thanks!!!
Post Reply