Skip to content

Instantly share code, notes, and snippets.

@justinkelly
Created September 19, 2011 12:00
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 justinkelly/1226364 to your computer and use it in GitHub Desktop.
Save justinkelly/1226364 to your computer and use it in GitHub Desktop.
To get the largest key in an array : PHP
<?php
/*
* To get the largest key in an array
*/
$array = array( 0 => 'first', 1=> 'second', /* ... */ 99 => 'nth' );
$max_key = max( array_keys( $array ) ); // 99
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment