Bas
Bas

Reputation: 2400

Count the required arguments of a method

Is it posible to count how many arguments are required from outside this class ?

Class a{
    Public function bbb ($A, $b, $c){
    }
}

Upvotes: 2

Views: 46

Answers (1)

splash58
splash58

Reputation: 26153

use class ReflectionMethod

class a { 
  function bbb ($A, $b, $c){
  }
}

$func_reflection = new ReflectionMethod('a','bbb');
echo $num_of_params = $func_reflection->getNumberOfParameters(); // 3

Upvotes: 4

Related Questions