PHP array_unshift() Function

PHP array_unshift() Function

The array_unshift () function in PHP prepends one or more elements to the beginning or front of an array. It returns the new number of elements in the array.

Syntax

Parameter

array(required)– This array represents the input array.

… (optional)– This parameter represents the values to prepend.

Return

This function returns the new number of elements in the array.

Example 1

Output

Example 2

Output

Example 3

Output