Last active
December 21, 2015 12:49
-
-
Save delputnam/6308052 to your computer and use it in GitHub Desktop.
Get the first element of an array using php.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This resets the array's internal pointer to the first element: | |
reset( $array ); | |
This does not modify the original array, but does make a copy of it, only use it for small arrays: | |
array_shift(array_values($array)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment