Originally we have an array as follow
$fruits = array( '0' => 'apple', '1' => 'banana', '2' => 'pear', );
So i want to insert “melon” into the 2nd position which is after “apple”. We can do it by array_splice().
Continue reading PHP – Insert and element into a specific position of an Array