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?

Accepted Answer

function debug_die() {
    call_user_func_array("debug", func_get_args());
    die;
}
Written by cdhowie
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki