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 :
$str = '1235, 3, 1343, 5, 1234, 1'; $res_str = array_chunk(explode(",",$str),2); foreach( $res_str as &$val){ $val = implode(",",$val); } echo implode(";",$res_str);