Created
September 19, 2011 12:00
-
-
Save justinkelly/1226364 to your computer and use it in GitHub Desktop.
To get the largest key in an array : PHP
This file contains 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
<?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