开发者

Argument Forwarding in PHP

Consider the following functions:

function debug() {
  $args = func_get_args();
  // process $args
}

function debug_die() {
  // call debug() with the passed arguments
  die;
}

The method debug_die exits after calling debug that takes a variable number of arguments. 开发者_如何学运维

So the arguments passed to debug_die as such are meant for debug only and just have to be forwarded. How can this be done in the debug_die method?


function debug_die() {
    call_user_func_array("debug", func_get_args());
    die;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜