i have class method which returns an associative array with a single value in it for example.
the following method call
print_r($acl->getPermNameFromId(1));
returns the following value
Array ( [permName] => Access Admin )
now instead of accessing the value by assigning the function call to a variable like
$permName = $acl->getPermNameFromId(1);
$permName = $permName['permName'];
is there any way i could directly access the value as a string?
for example i would like to access it by
echo $acl->getPermNameFromId(1){$permName};
ofcourse the above syntax is wrong. but is there any way PHP allow me to do this?
Thanks.
I don’t think your going to get it using direct access. My first thought was like @Cameron.
However, the next thing I thought about is some minor trick, but your making alot of assumptions that you will always return an array with that exact key, but because you asked.