Skip to content

Instantly share code, notes, and snippets.

@kosinix
Last active December 18, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosinix/5811314 to your computer and use it in GitHub Desktop.
Save kosinix/5811314 to your computer and use it in GitHub Desktop.
PHP - Simplest way to get first element of array
<?php
$arr = array( 4 => 'apple', 7 => 'orange', 13 => 'plum' )
echo reset($arr); //echoes "apple"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment