Answer the question
In order to leave comments, you need to log in
Is it possible in PHP to determine how many arguments a function requires?
There is a function:
function func($arg1, $arg2) {
}
args_func(func); // должно вернуть 2
Answer the question
In order to leave comments, you need to log in
https://www.php.net/manual/ru/class.reflectionfunc...
function func($arg1, $arg2 = null) {}
$refFunc = new ReflectionFunction('func');
print $refFunc->getNumberOfParameters(); // 2
print $refFunc->getNumberOfRequiredParameters(); // 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question