I have a string of that displays like this:
1235, 3, 1343, 5, 1234, 1
I need to replace every second comma with a semicolon
i.e.
Try this:
$val) { if ($counter%2 == 0) { $symbol=','; } else { $symbol=';'; } $new_str .= $val.$symbol; $counter++; } echo $new_str; //output::1235, 3; 1343, 5; 1234, 1; ?>