Skip to content

Instantly share code, notes, and snippets.

@delputnam
Last active December 21, 2015 12:49
Show Gist options
  • Save delputnam/6308052 to your computer and use it in GitHub Desktop.
Save delputnam/6308052 to your computer and use it in GitHub Desktop.
Get the first element of an array using php.
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