I have an array that is structured like this:
[players] => Array ( [0] => Array ( [name] => [DC]ClavisApocalyptica* [ping] => 42 [team] => 2 [score] => 20 [deaths] => 6 [keyhash] => 71b222c664a8f9ea56d0f1c80cfb28e5 [kills] => 14 ) [1] => Array ( [name] => SalamiFlavoredSpider [ping] => 50 [team] => 1 [score] => 7 [deaths] => 8 [keyhash] => 73f0f13b6e09c1fc812de7bd74648d24 [kills] => 5 ))
name: BLAH BLAHping: 42team: 2score: 2deaths: 0keyhash: 71b222c664a8f9ea56d0f1c80cfb28e5kills: 0name: BLAH BLAHping: 91team: 1score: 0deaths: 1keyhash: e25281cf1daf87dfc663023cb2ca7830kills: 0
[team] => 1
1/31/2006 6:38:51 PM
team1 = setof(i players players[i][team] == "1")print(team1)
1/31/2006 7:58:29 PM
sorry PHP
1/31/2006 8:33:54 PM
for ($i = 0; $i < sizeof($players); $i++){ if ($players[$i]['team'] == 1){ // do whatever }}
function saveTeam($val){ return ($val['team'] == 1);}array_filter($players, "saveTeam");
2/1/2006 4:43:07 PM
No why would i do that?People are always changing teams and all values change every second.Its a live script so DB is out of the question.I ended up using the Smarty Template System.Pretty cool if you ask me.
2/1/2006 5:18:15 PM
Well, in that case you obviously shouldn't.The code above will give you the array you want all the same.
2/1/2006 8:21:43 PM