extract string

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
anandkanatt
Forum Newbie
Posts: 3
Joined: Fri Aug 05, 2005 5:27 am
Location: Inside Apache
Contact:

extract string

Post by anandkanatt »

is there any way by which i can extract each word in a string which is separated by a comma??
eg. $string="a,b,c,d,e"

what i want is to extract a b c d e to separate variables?? :?:
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

look at split and explode functions
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

be advised, split() uses regular expressions, which means it will be slower than explode(), and slower than preg_split() as well.
Post Reply