The error I've found is that if you want to use the var in array, the array needs to be a variable defined in the function itself; not a returned value from a function. ( I also highly suspect that someArray()[2] doesn't work. )
PHP Code:
function someArray() {
return {0,1,2,3};
}
function onCreated() {
if ( 2 in someArray() ) {
echo("Works!");
} else {
echo("Doesn't work.");
}
}