xxxxxxxxxx
/*
In PHP, you can add an element to a specific position in an array using
the array_splice() function. This function takes four arguments:
The first argument is the array you want to add the element to.
The second argument is the index where you want to insert the element.
The third argument is the number of elements you want to remove (use 0 if you don't want to remove any elements)
The fourth argument is the element or elements you want to insert.
*/
$fruits = array("apple", "banana", "orange");
array_splice($fruits, 1, 0, "mango");
/*
This will insert the element "mango" at the index 1
and will not remove any elements, so the final array will be:
["apple", "mango", "banana", "orange"]
*/