When we want to insert element in an array then we can use array_push() function.
php array_push() function insert one or more elements to the end of an array
array_push() will always insert into numeric keys whenever you have string keys array
Ex 1. Numeric keys array
$arr = ['cat','dog']; array_push($arr,'cow','monkey'); print_r($arr);
Output:
Array ( [0] => cat [1] => dog [2] => cow [3] => monkey)
Ex 2. String keys array
$arr = ['a'=>'cat','b'=>'dog']; array_push($arr,'cow','monkey'); print_r($arr);
Output:
Array ( [a] => cat [b] => dog [0] => cow [1] => monkey)