Arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BlueFlame
Forum Commoner
Posts: 33
Joined: Wed Oct 12, 2005 5:21 am

Arrays

Post 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?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post 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).
Post Reply