Jump to content

read and use arrays


xbxgld

Recommended Posts

hello i have like game script to read/count players :

----------------------------

$index = count($gameserver);
while($index)
{
$index--;
list($game[$index], $host[$index], $port[$index], $queryport[$index]) = split(':', $gameserver[$index]);
}

-----------------------------

 

$gameserver = array(
'hl:cs.zcs.lt:27016:27016',
'hl:cs.zcs.lt:27030:27030',
'hl:cs.zcs.lt:27015:27015',
);
---------------------------------------
but when i use:
. '<tr valign="top"><td align="left">All Players :</td><td align="left">' . $gameserver = $srv_rules['nowplayers'] . '</td></tr>' . "n"

 

 

it is reads just 0 array server witch is 'hl:cs.zcs.lt:27016:27016', i understand it is starts from 0 1 2 ...... etc ... but how to make read all in arrays not just 0 ... was looking many forums reading many tutorials but maybe somewhere i cans understand something ... trying to read about count but it is not that what i am looking it is back with 3 it is just reads how many lines in arrays so i need count from 3 servers ... any help or tutorial where i can find out ?

 

. $gameserver = $srv_rules['nowplayers'] it is back like 16/32 and i am looking to make now players 45 ( read from all ip's )

 

Sorry for my bad English ...

Edited by xbxgld
Link to comment
Share on other sites

You probably should initialize the arrays before the loop:

$game = array();$host = array();$port = array();$queryport = array();

I don't know where $srv_rules is set, but that probably has something to do with it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...