I have this array:
$datos = array(
'titulo' => $titulo,
'contenido' => $contenido,
'usuario' => $usuario
);
And I want to add a new element but not only the value but also a key to be able to identify it, as it is in the array $datos
that I have already created.
So I try this:
array_push($datos, 'url_img' =>$fileNameNew);
but basically it tells me that it cannot have a key , but I would be interested in saving it with its key so that I can deal with it later in certain functions
Where I know there is no function to add
array
a new key and value.So I've created one:
Ver Demo
+ Info about
&
(Pass by reference)