php - Unnecessary array wrapper -
i stumbling on annoying , hope can shed light. generating array via php mysql query. while statement follows:
$model[constraints][d][] = array($row['node'] => array("max" => $row['dem'], "min"=> $row['dem'])); the problem each new array added $model[constraints][d] gets enclosed array. see screenshot below:

i don't want there array "0" around norway. able access values follows:
$model[constraints][s][norway][max] right now, way can access value doing following:
$model[constraints][s][0][norway][max] how should amend while statement desired array? thank time.
before loop do:
$model[constraints][d] = array(); and change statement inside loop to:
$model[constraints][d] += array($row['node'] => array("max" => $row['dem'], "min"=> $row['dem']));
Comments
Post a Comment