I figured it out.
For an array to store objects it must be a TStaticVar;
PHP Code:
channel = new TStaticVar();
channel.join("chat_channel");
channel.create(topic, owner, channelname);
//Doesnt work:
test.add(channel);
echo(test[0].channelname);
//works:
test2 = new TStaticVar();
test2.add(channel);
echo(test2[0].channelname);
Strange that it used to work though.