PHP array_push without numeric key
Use +
for this. Try with -
$array = array('connect' => array('mydomain.com' => 1.99) );
$array['connect'] += array('mynewdomain.com' => 2.99);
Simply append element to the array.
$array['connect']['mynewdomain.com'] = 2.99;
No need to do array_push()
. Just use PHP
's in built constructs to get the job done.
In Built language constructs are more faster than in built functions and custom functions.
Use array_merge()
:
$array['connect'] = array_merge($array['connect'], $new_array);