You can use array_push() available in PHP for doing this. Below mentioned is the example code in PHP Manual
Code:
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>
he above example will output:
Code:
Array
(
[0] => orange
[1] => banana
[2] => apple
[3] => raspberry
)
A demo and explanation can be found here
In JavaScript there is a push() associated to the Array object using which you can achieve the same effect
Code:
var newArray = new Array(10);
newArray.push("a","b","c");
Bookmarks