I have a PHP function that can take a variable number of arguments (and I use func_get_args()
to process them)
class Test {
private $ting = FALSE;
public function test() {
$args = func_get_args();
if ($this->ting) {
var_dump($args);
} else {
$this->ting = TRUE;
$this->test($args); //I want to call the function again using the same arguments. (this is pseudo-code)
}
}
}
This function is not recursive (the "$ting" variable prevents it from going more than once).
I want test() to call itself using the same arguments it was given. So for example:
Test->test("a", "b", "c");
would output the following:
array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" }