函数call_user_func_array中的MathParser错误

时间:2018-07-23 20:06:15

标签: php call-user-func-array

我有一个数学解析器库,但是它包含一个简单的错误。类中抛出了一些方法,并且有这样的调用:

ItemID  FID1    FID2    FID3    FName1  FName2  FName3  
100084  2545    2536    2535    Name 1  Name 2  Name 3

当此方法调用类的魔术方法时,当我调用此类函数时,该函数将起作用

class Mathparser_NParamNode extends Mathparser_Node {
public $nodes; //array of nodes (these are the parameters).
public $fPtr; //function to execute

public function __construct($n, $FuncAddr) {
    $this->nodes = &$n;
    $this->fPtr  = $FuncAddr;
}
public function getValue() {
    if($this->fPtr->Name=='IF'){
        //special case for short circuit boolean logic.
        //helps to avoid div by zero etc.
        //assume there are 3 parameters:
        $cond = $this->nodes[0]->getValue();
        if($cond==0){ //false:
            return $this->nodes[2]->getValue();
        }else{
            return $this->nodes[1]->getValue();
        }
    }else{
        $p = array();
        $count = count($this->nodes);
        for($i=0; $i<$count; $i++){
            $p[]=$this->nodes[$i]->getValue();
        }

        print_r($this->fPtr->EventHandler);

        return call_user_func_array($this->fPtr->EventHandler, $p);
    }
}

获取此错误:: call_user_func_array()期望参数1为有效的回调,找不到函数“ mp_div_”或无效的函数名称, 如何调用此功能?类工作创建的魔术方法

0 个答案:

没有答案