Solved the problem.
PHP Code:
function onPlayerChats() {
temp.toks = null;
temp.com = null;
temp.toks = player.chat.tokenize();
temp.com = temp.toks[0].substring(1);
switch (temp.com) {
case "global":
echo("boo");
break;
default:
echo("bark");
break;
}
}