I have the following problem.
A fix
$arreglo = array(
'form' => array(
'descripcion' => array(
'titulo' => 'test',
'icon' => 'icon-cogs',
),
'frutas' => array(
array(
'nombre' => 'Manzana',
'color' => 'Roja',
'Sabor' => 'Dulce',
),
array(
'nombre' => 'Pera',
'color' => 'Verde',
'Sabor' => 'Dulce',
),
),
'submit' => array(
'titulo' => 'Guardar',
),
),
);
print_r($arreglo);
Then what I need is: Add subarrays on the fruits index, the closest thing I have achieved is:
array_push($arreglo, array('frutas' => array(
array(
'nombre' => 'Fresa',
'color' => 'Rojo',
'Sabor' => 'Dulce',
),
),));
but the above generates a new index and I need the same one.
How can I add subarrays above the fruits index?
Instead of performing a push, you could do it like this:
That would add a new fruit, inside
frutas