Creating JSON from a comma delimited string with PHP

LS

New Member
I am trying to create JSON from a comma delimited string, the string look something like this:\[code\]One,Two,Three,Four,Five,Six,Seven\[/code\]I need it to look something like this: \[code\][{"test":"One"},{"test":"Two"},{"test":"Three"},{"test":"Four"},{"test":"Five"},{"test":"Six"},{"test":"Seven"}]\[/code\]Here is the code I have thus far:\[code\]$string = mysql_fetch_array($test, true);$woot = explode(',', $string['test']);$json = json_encode($woot);echo($json);\[/code\]Thanx in advance!
 
Back
Top