Page 1 of 1

Arrays

Posted: Sat Oct 15, 2005 6:44 am
by BlueFlame
Im new to PHP, i have seen in many scripts that they have arrays echo'ed out like $something->somethingelse. I thought an array was suposs to be like $something[somethingelse]. any way could someone just tell me what this is
AND
iv got an array with Player names from a game server running Call of duty in it, I want to echo out the first three leaders that have the highest score on that server, this array holds the scores and the names of the players, how do I just narrow is down to the players with the highest score?

Posted: Sat Oct 15, 2005 6:56 am
by shiznatix
first:

$somthing->somthingelse() is a call to a class function. this is not a array.
$this['that'] is a element of a array and probably not a array itself although it can be a array. $this would be the actual array

second:

read the manual http://www.php.net and read the different sort commands, those will show you how to sort a array by whatever means you need and then you can just echo out the first 3 elements of the array which would be the top 3 players after you sort it properly

Posted: Sat Oct 15, 2005 7:45 am
by foobar
shiznatix wrote: $somthing->somthingelse() is a call to a class function. this is not a array.
Or a PHP Struct (if you ommit the parentheses).