I'm facing a problem that I can't solve on my own, I can't find a way to do it.
I have those two strings:
'Germany, "Sightseeing, Travelling, Hotels"'
and
'Health, Medicin, Healthcare'
I need to explode() this strings on the , char, but only if the text, where this , lays in isn't surrounded by ".
So, as example this would be the desired results:
array(0 => 'Germany', 1 => '"Sightseeing, Travelling, Hotels"');
array(0 => 'Health', 1 => 'Medicin', 2 => 'Healthcare');
By now this is what I have:
explode(",", 'Germany, "Sightseeing, Travelling, Hotels"');
Which will give out
array(0 => 'Germany', 1 => '"Sightseeing', 2 => 'Travelling', 3 => 'Hotels"');
How can I get to this result?