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:

enter image description here

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'])); 

here's live demo


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -