I am looking for the exact type of a Required Parameter
in a PHP Function signature
Does initializing a parameter only with NULL makes it an optional? i.e
function foo($optional=NULL, $OptionalOrRequired="Optional Or Required", $required){}
I am confused about the 2nd argument, does it comes in Required or Optional parameter?
UPDATE
I am using reflection
to get all and required parameters of a function
public function getPlayer($params=3, $c){}
// results
$reflection->getNumberOfParameters() -> 2
$reflection->getNumberOfRequiredParameters() -> 2 // it should be one
public function getPlayer($params=3, $c, $x=NULL)
// results
$reflection->getNumberOfParameters() -> 3
$reflection->getNumberOfRequiredParameters() -> 2
As i get in one answer that defaults comes before required, is this the reason the reflection function is returning wrong count for required parameters?
Thanks