- array_splice: documentation ( source)
<?php
$original = array( '1','2','3','4','5' );
echo 'Original array : <br />';
foreach ($original as $x)
{echo "$x ";}
$inserted = '$';
array_splice( $original, 3, 0, $inserted );
echo " <br /> After inserting '$' the array is :<br />";
foreach ($original as $x)
{echo "$x ";}
?>
- See more at: http://www.w3resource.com/php-exercises/php-array-exercises.php#sthash.XlnDnR3J.dpuf