Optional array wrapper
I am stumbling over something annoying and hope you can shed some light. I am generating array via PHP MySQL query. My WHILE statement looks like this:
$model[constraints][d][] = array($row['Node'] => array("max" => $row['dem'], "min"=> $row['dem']));
The problem is that every new array added to $ model [constraints] [d] ends up in the array. See screenshot below:
I donβt want a "0" around Norway. I would like to be able to access my values ββlike this:
$model[constraints][s][Norway][max]
Right now, the only way to access this value is by doing the following:
$model[constraints][s][0][Norway][max]
How do I modify my while statement to get the array I want? Thank you for your time.
+3
source to share