I have a function getStatus() that returns an associative array.
Right now I’m accessing a value with two commands:
$a = $user->getStatus();
$a = $a['keyName'];
doSomething($a);
Is there a way to rephrase that into one command like:
doSomething($user->getStatus()['keyName']);
No, unfortunately that doesn’t work.
However, if the order of the returned elements is fixed, you could write something like
Or you could write a function that returns an array value: