php man page for array_push

Query: array_push

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

ARRAY_PUSH(3)								 1							     ARRAY_PUSH(3)

array_push - Push one or more elements onto the end of array

SYNOPSIS
int array_push (array &$array, mixed $value1, [mixed $...])
DESCRIPTION
array_push(3) treats $array as a stack, and pushes the passed variables onto the end of $array. The length of $array increases by the num- ber of variables pushed. Has the same effect as: <?php $array[] = $var; ?> Note If you use array_push(3) to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function. Note array_push(3) will raise a warning if the first argument is not an array. This differs from the $var[] behaviour where a new array is created.
PARAMETERS
o $array - The input array. o $value1 - The first value to push onto the end of the $array.
RETURN VALUES
Returns the new number of elements in the array.
EXAMPLES
Example #1 array_push(3) example <?php $stack = array("orange", "banana"); array_push($stack, "apple", "raspberry"); print_r($stack); ?> The above example will output: Array ( [0] => orange [1] => banana [2] => apple [3] => raspberry )
SEE ALSO
array_pop(3), array_shift(3), array_unshift(3). PHP Documentation Group ARRAY_PUSH(3)
Related Man Pages
array_replace(3) - php
array_replace_recursive(3) - php
asort(3) - php
array_splice(3) - php
array_unshift(3) - php
Similar Topics in the Unix Linux Community
Array length in PERL
array
parse by string and difference in substring???
How to replicate data using Uniq or awk
Printing array elements in reverse