开发者

Function in PHP deprecated, what should I use now?

开发者 https://www.devze.com 2022-12-18 03:08 出处:网络
I have this code in one of my classes public function __call($method, $args) { array_unshift($args, $method);

I have this code in one of my classes

 public function __call($method, $args) {

        array_unshift($args, $method);

        call_user_method_array('view',开发者_开发百科 $this, $args);

    }

We've since switched servers, and they must use a newer version of PHP5, and I get the following message

Function call_user_method_array() is deprecated

Is there where I should use reflection? What exactly is it, and how would I use it to modify my code above to work as it used to?


http://php.net/manual/en/function.call-user-method-array.php

The call_user_method_array() function is deprecated as of PHP 4.1.0.

New way:

<?php
// Old:
// call_user_method_array('view', $this, $args);
// New:
call_user_func_array(array($this, 'view'), $args);
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消