This can be done by array.splice() More details [here][1] ```php $array_1 = array( '0' => 'zero', '1' => 'one', '2' => 'two', '3' => 'three', ); $array_2 = array( 'zero' => '0', 'one' => '1', 'two' => '2', 'three' => '3', ); array_splice($array_1, 3, 0, array('sample_key' => 'sample_value')); array_splice($array_2, 3, 0,array('sample_key' => 'sample_value')); print_r($array_1); /* Result will be: Array ( [0] => zero [1] => one [2] => two [3] => sample_value [4] => three ) */ print_r($array_2); /* Result will be : Array ( [zero] => 0 [one] => 1 [two] => 2 [0] => sample_value [three] => 3 ) */ ``` [1]: https://www.php.net/manual/en/function.array-splice.php