array_push
array_push
Push one or more elements onto the end of array
int **array_push** array $array mixed $values
treats as a
stack, and pushes the passed variables onto the end of . The length of increases by the number of variables pushed. Has the same effect as:
repeated for each passed value.
`array_pusharrayarray``array````php
> **Opmerking:** > If you use to add one element to the
> array, it's better to use because in that
> way there is no overhead of calling a function.
> `array_push``$array[] =`
> **Opmerking:** > will raise a warning if the first
> argument is not an array. This differed from the
> behaviour where a new array was created, prior to PHP 7.1.0.
> `array_push``$var[]`
`array`The input array.
`values`
The values to push onto the end of the .
`array`
Returns the new number of elements in the array.
**Voorbeeld: example**
```php
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>
Array
(
[0] => orange
[1] => banana
[2] => apple
[3] => raspberry
)
array_pop``array_shift``array_unshift