【发布时间】:2016-12-15 09:39:09
【问题描述】:
我想知道您是否可以从外部范围获取 php 函数参数的参数长度。
$test = function($one, $two) {
// this will work inside the scope of the function
$length = func_num_args();
};
// I would like to access it from outside the functions scope
$length = get_arg_count(test); // => 2
如果我 var_dump(test) 我可以在 properties 的闭包上看到一个属性,但我无法获得它。
有func_num_args(void),但只能在函数范围内工作。
我试过了……
test->properties;
test->properties();
test::properties;
test::properties();
test['properties'];
【问题讨论】: