开发者

Argument Forwarding in PHP

开发者 https://www.devze.com 2023-01-24 19:24 出处:网络
Consider the following functions: function debug() { $args = func_get_args(); // process $args } function debug_die() {

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

精彩评论

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