I need to explode a string by commas but not within quotes(«»).
I have a string like: "5,test2,4631954,Y,«some, string, text.»,299.00 TJS,http://some-link"
i want this result:
[
0 => 5,
1 => test2,
2 => 4631954,
3 => Y,
4 => «some, string, text.»,
5 => 299.00 TJS,
6 => http://some-link
]
Tried with preg_split, str_getcsv but didnt get needed result.
$res = str_getcsv($res, ',');
$res = preg_split("/(?<=\)),/", $res);