I am trying to insert code (double Arrow) into an array. But no matter how I try, I can’t get it to work. My actual attempt is to push the new code to the variable but I’m getting this error:
"syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW)"
What is the right way to add code to that array?
$shortcode[] = 'attendee_name' => $tickets[0]['shortcode_data']['attendee_name'];
$shortcode = array(
'product_name' => $tickets[0]['shortcode_data']['product_name'],
'start_time' => $tickets[0]['shortcode_data']['start_time'],
'end_time' => $tickets[0]['shortcode_data']['end_time'],
);
Thanks!
>Solution :
you probably want to just assign to a key:
$shortcode = array(...);
$shortcode['attendee_name'] = $tickets[0]['shortcode_data']['attendee_name'];