You have to create a TStaticVar then assign it a variable. I.e:
PHP Code:
function onCreated() {
temp.obj2 = test();
echo(temp.obj2.hello);
temp.obj2.destroy();
// this also works
echo(test().hello);
}
function test() {
temp.obj = new TStaticVar();
temp.obj.hello = "world";
return temp.obj;
}
You can write some neat looking code when you return object references.