I was browsing another forum earlier today and came across someone who wanted to split a string into an array. That's a fairly simple task with explode(). But they also wanted anything in between brackets to be left alone.
I came up with a solution that works fine, but I'm fairly certain there's a better way to do it. Here's what I've got.
Not too sure about using preg_split but here's a possible regex solution:
# Previous character is start of string or a comma
# Zero or more non-curly brace characters between curly braces
# Zero or more non-comma characters
/x', $string, $matches);