September 2001
Intermediate to advanced
768 pages
32h 45m
English
int array_unshift(array array, mixed var, mixed ...)
| array | Array to modify |
| var | Value to prepend to array |
| ... | Further values to prepend to array |
Pushes the list of elements onto the given array.
Returns:
Number of elements in the revised array; NULL on failure
Description:
Prepends the new elements onto array in the order given as arguments. The first element in the argument list becomes the first element in the array. Returns the number of elements in the revised array. This function changes the original array.
Combined with array_pop(), this function can be used to make an array act in FIFO (first-in-first-out) fashion.
Version:
PHP 4
See also:
array_pop() array_push() array_shift()
Example:
Read now
Unlock full access