Calling static method from object array variable

前端 未结 3 1531
后悔当初
后悔当初 2021-01-07 23:27

In PHP you can call a class\'s static method from an object instance (which is contained in an array) like this:

$myArray[\'instanceOfMyClass\']::staticMetho         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-08 00:17

    You actually can use "->" to call static method:

    $this->myArray['instanceOfMyClass']->staticMethod();
    

提交回复
热议问题