← All built-ins / array_shift()
array_shift()
array_shift(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $a | array | array (by reference) |
Return value
The removed first element; the rest is re-indexed.
Example
$a = [1, 2, 3];
$first = array_shift($a);
echo $first, " ", implode(",", $a);1 2,3