Replace string separated with comma

Go To


Is there any way to change or convert a strings/int that are separated with commas?

Example :

$str = "121,232,343,454";

should result into :

str1, str1, str1, str1

2012-04-04 05:00
by user1311955
u mean the result should be , str1=121, str2=232, str=343 like thi - shanish 2012-04-04 05:02
Your example makes no sense to me. Could you explain what you've tried, the results you got, and maybe add a second example - sarnold 2012-04-04 05:02
First, what programming language are you using - Greg Hewgill 2012-04-04 05:04
I am using PHP, what I want supposed to be displayed is the same result each word/integer separated by comma - user1311955 2012-04-04 05:28


Depending on the language you are using, this is often the split($str, ',') or split(',', $str) or $str.split(',') function

2012-04-04 05:02
by ninjagecko


split() is deprecated !!! Please use explode($seperator, $string) instead.

$str = "a,b,c";
$items = explode(',', $str);
2012-04-04 05:44
by peipst9lker