$result = array_splice( $yourArray, 0, 1 );

... should do the trick. See array_splice.

Answer from Decent Dabbler on Stack Overflow
🌐
PHP
php.net › manual › en › function.array-shift.php
PHP: array_shift - Manual
Notice: the complexity of array_pop() is O(1). the complexity of array_shift() is O(n). array_shift() requires a re-index process on the array, so it has to run over all the elements and index them. ... Just a useful version which returns a simple array with the first key and value. Porbably a better way of doing it, but it works for me ;-) <?php function array_kshift(&$arr) { list($k) = array_keys($arr); $r = array($k=>$arr[$k]); unset($arr[$k]); return $r; } // test it on a simple associative array $arr = array('x'=>'ball','y'=>'hat','z'=>'apple'); print_r($arr); print_r(array_kshift($arr)); print_r($arr); ?> Output: Array ( [x] => ball [y] => hat [z] => apple ) Array ( [x] => ball ) Array ( [y] => hat [z] => apple )
🌐
W3Schools
w3schools.com › php › func_array_shift.asp
PHP array_shift() Function
Loops While Loop Do While Loop For Loop Foreach Loop Break Statement Continue Statement PHP Functions PHP Arrays
People also ask

How does array_shift work with associative arrays?
$user = ['name' => 'John', 'age' => 25];
$first = array_shift($user);
print_r($user); // ['age' => 25]
echo $first; // John
It removes the first key-value pair based on internal order.
🌐
flatcoding.com
flatcoding.com › home › php array_shift: remove the first array element with examples
PHP array_shift: Remove the First Array Element with Examples - ...
What is the difference between array_shift and array_pop?
$arr = [1, 2, 3];
array_shift($arr); // removes 1 from start
array_pop($arr); // removes last element
array_shift removes from the beginning, array_pop removes from the end.
🌐
flatcoding.com
flatcoding.com › home › php array_shift: remove the first array element with examples
PHP array_shift: Remove the First Array Element with Examples - ...
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-array_shift-function
PHP array_shift() Function - GeeksforGeeks
June 20, 2023 - <?php // PHP function to illustrate the use of array_shift() function Shifting($array) { print_r(array_shift($array)); echo "\n"; print_r($array); } $array = array(45, 5, 1, 22, 22, 10, 10); Shifting($array); ?> Output:
🌐
FlatCoding
flatcoding.com › home › php array_shift: remove the first array element with examples
PHP array_shift: Remove the First Array Element with Examples - FlatCoding
September 7, 2025 - The array_shift function in PHP takes the first element from an array and returns it. It also moves all other elements down by one position.
🌐
Codecademy
codecademy.com › docs › php › arrays › array_shift()
PHP | Arrays | array_shift() | Codecademy
September 9, 2023 - The array_shift() pops the first value of the array off and returns it, shortening the array by one element and shifting each element down.
Find elsewhere
🌐
Envato Tuts+
code.tutsplus.com › home › coding fundamentals
Pop and Shift Arrays With PHP: When to Use Each One | Envato Tuts+
December 31, 2021 - The array_shift() function will shift an element off the start of an array.
🌐
Jobtensor
jobtensor.com › Tutorial › PHP › en › Array-Functions-array_shift
PHP Built-in array_shift(), Definition, Syntax, Parameters, Examples | jobtensor
The array_shift() function removes the first element from an array, and returns the value of the removed element. ... <?php // Example $ages = array("Mark" => 22, "Jeff" => 32, "Mike" => 28); echo array_shift($ages); echo "<br>"; print_r($ages);
🌐
Reintech
reintech.io › blog › phps-array-shift-and-array-unshift-functions-a-complete-guide
PHP's `array_shift()` and `array_unshift()` Functions: A Complete Guide | Reintech media
April 14, 2023 - Learn how to effectively use PHP's built-in functions array_shift() and array_unshift() for managing arrays with this comprehensive tutorial.
🌐
3D Bay
clouddevs.com › home › php guides › php’s array_shift() function: a complete guide
PHP's array_shift() Function: A Complete Guide
December 11, 2023 - ... The array_shift() function in PHP serves a straightforward purpose: it removes and returns the first element from an array. This operation modifies the original array, reducing its length by one.
🌐
ZetCode
zetcode.com › php-array › array-shift
PHP array_shift - Array Manipulation in PHP
Syntax: array_shift(array &$array): mixed. The function modifies the original array and returns the shifted value.
🌐
Daviddemartini
blog.daviddemartini.com › home › technology › software development › php array_shift() not a function for general use
PHP array_shift() not a function for general use | David DeMartini actual
August 16, 2013 - So, in theory one could use this to get the first element off an array automatically, without removing it. OK, but shift_array does this ANY removes the element. So this is not really the same action. However… (and you know there is a point there), there is another PHP function with a useful side effect.
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-remove-first-element-from-an-array-in-php
How to Remove First Element from an Array in PHP? - GeeksforGeeks
July 23, 2025 - The array_shift() function removes the first element from an array and returns it. This function modifies the original array. ... <?php $arr = array(10, 20, 30, 40, 50, 60); $removedElement = array_shift($arr); echo "Removed element: " . ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › shift
Array.prototype.shift() - JavaScript | MDN
The shift() method is a mutating method. It changes the length and the content of this. In case you want the value of this to be the same, but return a new array with the first element removed, you can use arr.slice(1) instead.
🌐
Mc
sandbox.mc.edu › ~bennet › php › man › function.array-shift.html
array_shift
array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down.
🌐
w3resource
w3resource.com › php › function-reference › array_shift.php
PHP : array_shift() function - w3resource
August 19, 2022 - PHP: array_shift() function: The array_shift() function is used to remove the first element from an array, and returns the value of the removed element.