0

是否可以直接调用从方法数组返回的值?
例如

<?php
class test
{
    public function echo_test()
    {
        $return_value["a1"] = "a1a1";
        $return_value["b1"] = "b1b1";
        return $return_value;
    }
}

$newObj = new test();
echo $newObj->echo_test()['a1'];  //<----- this does not seem to work
echo $newObj->echo_test()->a1; //<--------- this does not seem to work as well
echo $newObj['a1']->echo_test(); //<--------- this also do not work

?>
4

0 回答 0