Re: Array difficulty

From: Date: Tue, 31 Jul 2007 13:54:40 +0000
Subject: Re: Array difficulty
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-259905@lists.php.net to get a copy of this message
At this point, $result would be equal to "uppercase". I feel like this is a really kludgey way to accomplish this. Is there a better way?
Not tested it, but max() should work as the first parameter can be an array: http://uk3.php.net/max
Except he's looking for the key and not the value, which max() would return. Come to think of it, the solution I provided does the same thing. Untested but one of the below should work: arsort($chance); $lastItem = key( $chance[( count( $chance ) - 1 )]); OR arsort($chance); $lastItem = key( end( $chance )); thnx, Chris

« previous php.general (#259905) next »