Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save calvinchoy/5195778 to your computer and use it in GitHub Desktop.

Select an option

Save calvinchoy/5195778 to your computer and use it in GitHub Desktop.
PHP get first key and value from array
<?php
//Get first key and value from an array
$first_value = reset($array);
$first_key = key($array);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment