HI I get a string in our data base after completing a quiz which contains the results of each question in a single string. like:
&q1=2&q2=5&q14=7&q6=8&q4=9&q19=10&q12=1&q20=3
each question can be skipped for a while to answer later, so the answers are unsorted. now I want the results like
q1=2,q2=5,q4=9,q6=8,q12=1,q14=7,q19=10,q20=3
Can anyone help me.?
Try this
$a='&q1=2&q2=5&q14=7&q6=8&q4=9&q19=10&q12=1&q20=3';
$b=explode('&',$a);
natsort($b);
$c=implode(',',$b);
print($c);