PHP array_shift() Function

PHP array_shift Function


The array_shift() function shifts or removes the first element from an array.

Syntax

The basic syntax of the array_shift() function is given with:

  array_shift(array);

Parameters

The array_shift() function accepts the following parameters.

Parameter Description
array Required. Specifies the array to work on.

 Example1 :

Output : 

Web

Array
(
    [0] => desgining
    [1] => house
    [2] => online
)

Example2 : 

Output : 

apple

Array
(
    [b] => ball
    [c] => cat
    [d] => dog
)