0
I started an array ($arrDados=array();) and now I need to add information (array_push) so that I can access the information later on as follows:
colA1 = $arrDados['NumeroEmpenhoAno']['code'];
colA2 = $arrDados['NumeroEmpenhoAno']['size'];
colB1 = $arrDados['UnidadeOrc']['code'];
colB2 = $arrDados['UnidadeOrc']['size'];
What would be the array_push code to be able to access this array in the above structure?
I’m trying the code below, but it’s wrong:
$arrDados=array();
array_push($arrDados,array('NumeroEmpenhoAno' => array('code' => 0,'size' => 1)));
array_push($arrDados,array('UnidadeOrc' => array('code' => 1,'size' => 2)));
The way I’m doing it, I’m having to access it the following way:
colA1 = $arrDados[0]['NumeroEmpenhoAno']['code'];
but I want to:
colA1 = $arrDados['NumeroEmpenhoAno']['code'];
That is, without indexes.
Perfect, thank you, worked perfectly!
– Marlon