Re: [PHP] Array difficulty
- From: chris.boget@xxxxxxxx ("Chris Boget")
- Date: Tue, 31 Jul 2007 09:54:40 -0400
At this point, $result would be equal to "uppercase". I feel likeNot tested it, but max() should work as the first parameter can be an
this is a really kludgey way to accomplish this. Is there a better way?
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 .
- References:
- Array difficulty
- From: Carlton Whitehead
- Re: [PHP] Array difficulty
- From: Richard Davey
- Array difficulty
- Prev by Date: Re: [PHP] Re: Pirate PHP books online?
- Next by Date: Re: [PHP] Array difficulty
- Previous by thread: Re: [PHP] Array difficulty
- Next by thread: Re: [PHP] Array difficulty
- Index(es):