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