I get data from MySQL query by using GROUP_CONCAT:
GROUP_CONCAT('id => ',assignments.userid,', assigned => ',assignments.assigned SEPARATOR ';') as assigneeids
And trying to convert it to PHP array.
$assignees = explode(';', $ticket['assigneeids']);
foreach($assignees as $assignee) {
echo "$assignee\n"; // $assignee['id'] outputs 'i'
echo gettype($assignee) . '\n';
}
But unfortunately $assignee becomes a string instead of array. Output:
id => 1001, assigned => 1419648601
string
id => 1002, assigned => 1419649207
string
What am I doing wrong?
eval(), but that is not the way to approach this. Can you clarify that your goal is to produce arrays with the 2D structure containing sub arraysarray('id' => 1234, 'assigned' => 987654)?