Cleaned up the source code a little bit, added size since it was right there.
gs2_setup() - Implements some GS2-like functionality.
gs2_script() - Does some small conversions.
gs2_emulate() - Calls setup, clears output, gets script, and evals it as JS.
So if you want to add to it go for it.
This also works now but I would suggest not trying to script on your phone.
PHP Code:
function onCreated() {
temp.I =0;
temp.t = ["Paul", "frank", "Sam"];
for (temp.I=0; temp.I < temp.t.size(); temp.I++){
echo(temp.t[temp.I]);
}
}