Reputation: 101
This is my associative array.
$family = array("Mike"=>array("Ben","klatty","Paul"),"Johnson"=>array("Shena", "Glenn"));
$family['shrinidhi']=array("akshata","pandu");
this works fine.
I would like to push an array into $family dynamically. i.e
$family['$contact["values"][$i]["contact_id"]']= array($phone_nums[$i]['values'][$j]['phone'],$phone_nums[$i]['values'][$j]['phone_type_id']));
Thank you in advance
Upvotes: 2
Views: 82
Reputation: 12127
no need (')
quote when you are using variable value in index
change
$family['$contact["values"][$i]["contact_id"]']
to
$family[$contact["values"][$i]["contact_id"]]
Upvotes: 2