By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

split string

P: 83
I am new to php. My program is to split the give string seperated by comma.
that is the

input is $str = "mysql,php,java,javascript,ect";

output we want is
mysql
php
java
javascript
ect

How can i do this.please help me to solve this program

Thanks in Advance
Sang
Jan 31 '07 #1
Share this Question
Share on Google+
1 Reply


ronverdonk
Expert 2.5K+
P: 4,258
Use the PHP explode() function. See explode function.

For your particular case you can program it like[php]$items = explode(',', $str);
for ($i=0; $i<count($items); $i++)
echo $items[$i].'<br>';[/php]
Ronald :cool:
Jan 31 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.