View Single Post
  #1  
Old 11-21-2008, 04:41 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
"in" operator on returned array.

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.");
  }

Reply With Quote