php append in array code example
Example 1: add item to array in php
<?php
$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
Example 2: php insert in array
$original = array( 'a', 'b', 'c', 'd', 'e' );
$inserted = array( 'x' ); // not necessarily an array, see manual quote
array_splice( $original, 3, 0, $inserted ); // splice in at position 3
// $original is now a b c x d e