Menu Home

array_push

osbo.com | PHP | Functions | array_push

Push one or more elements onto the end of array

Syntax

array_push ( array &$array [, mixed $... ] ) : int

Parameters

array

The input array.

...

The values to push onto the end of the array.

Return

Returns the new number of elements in the array.

Examples

array

<?

$array = array("orange", "banana");

$return = array_push($array);

print_r($return);

?>
2

...

<?

$array = array("orange", "banana");

$return = array_push($array, "apple", "raspberry");

print_r($return);

?>
4

Internal

array_pop

array_shift

array_unshift

External

PHP