I'm trying to call an array variable directly from a method that returns it. Something like the following:
function some_meth()
{
return array('var1' => 'var);
}
I know I can do something like this:
$var = some_meth();
$var = $var['var1'];
But I would like to be able to do this in one line, something like this:
$var = some_meth()['var1'];
This returns the error below, which makes sense, but is there a way to do this in one line?
Trying to get property of non-object