array_push() function appends one or more values onto the end of the array.
//Its syntax is: int array_push(array array, mixed var, [. . . ])
<?
$languages = array("A", "B", "C");
array_push($languages, "Russian", "German", "Gaelic");
print_r($languages);
?>
==
array_pop() function removes a value from the end of the array. This value is then returned.
//Its syntax is: mixed array_pop(array array)
//Each iteration of array_pop() will shorten the length of the array by 1.
<?
$languages = array ("Spanish", "English", "French", "Gaelic");
$a_language = array_pop ($languages);
print $a_language;
$a_language = array_pop ($languages);
print_r( $a_language);
?>
Related examples in the same category