I have data that outputs like this:
“Option 1” “Blue” “Tan”
It’s all on one line; it’s all in one field in my database table. (Please don’t ask why) But what I need is this:
Array
(
[0] => Option 1
[1] => Blue
[2] => Tan
)
I’m trying this regular expression:
$data = preg_match('/\"([^\"]*?)\"/', $row4['Data'], $matches);
But $matches only yields the first element like this:
Array
(
[0] => "Option 1"
[1] => Option 1
)
What do I need to do to get anything in between quotes to be their own separate element in an array?
You need to use
preg_match_all().preg_match()only returns the first match.