I would like to use a php array in this example rather than have to hard code the array. How would I use a php to replace this json example?
Here the working code with the json array:
$json_string = array(
'to' => array(
'example1@sendgrid.com', 'example2@sendgrid.com'
),
'category' => 'test_category'
);
But I need to replace the 'to' values with my own php array. I tried this but it doesn't work:
$myEmails[] = array('emailOne@gmail.com','email2@gmail.com');
$json_string = array(
'to' => $myEmails, /// DOES NOT WORK
'category' => 'test_category'
);
What code for the json could I use to add my own php array values here? In short I am trying to send multiple emails using sendgrid but I thought this might work but its not.