Access array returned by a function in php -


i'm using template engine inserts code in site want it.

i wrote function test quite easy:

myfunction() { return '($this->data["a"]["b"] ? true : false)'; } 

the problem is, $this->data private, , can't access everywhere, have use getdata(); causes problem.

$this->getdata()['a']['b'] 

does not work, , assigning value first doesn't either because used directly in if() block.

any ideas?

since php 5.4 it's possible that:

getsomearray()[2] 

reference: https://secure.php.net/manual/en/language.types.array.php#example-62

on php 5.3 or earlier, you'll need use temporary variable.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -