我一直在PHP中制作一个IRC bot。我为0到5之间的不同用户提供了特定的访问级别.0是来宾,5是管理员。通过多维关联数组循环遍历
我一直在试图编写一个命令,当用户访问它时,它会向它们发送一个允许使用的命令和语法列表。
到目前为止,我有这样的事情
$array = array
(
"5" => $commands = array
(
"test" => $test2 = array
(
"trigger" => "!test",
"descrip" => "Just testing."
)
"test2" => $test3 = array
(
"trigger" => "!lol",
"descrip" => "another test."
)
)
);
我不知道如何通过其循环,使if ($accessLevel == 5) then show commands for $array[5(and below)]
最后我希望它送出去$array[5][command][trigger] : $array[5][command][descrip]
我不不一定需要你为我编写代码,只要朝正确的方向推进就会有所帮助。
我绝对喜欢使用数组标记的想法。这使它更清洁。让我试试这个报告。 – Rob 2011-01-24 18:45:24