I was wondering if there is a way to return an array value from a function that returns an array inline. So if I have a function like:
class MyObj
{
public function myFunction()
{
return array('arrayIndex'=>'myValue');
}
}
I would like to be able to do this:
$object = new MyObj();
$myValue = $object->myFunction()['arrayIndex']; //but this doesn't work
rather than this:
$object = new MyObj();
$myArray = $object->myFunction();
$myValue = $myArray['arrayIndex'];
Simple question but I just don't know if its possible to reference it in a similar way. So yay or nay?