dimanche 11 février 2018

In PHP, are optional parameters and parameters with default values the same thing?

I am learning about Reflection in PHP, and I came across two methods of interest when looking at the parameters of a function: ReflectionParameter::isOptional and ReflectionParameter::isDefaultValueAvailable.

Both methods return boolean values indicating whether the parameter is an optional parameter and whether the parameter has a default value available, respectively.

For the life of me, I can't imagine how these two methods will ever return different values, but the manual at this point gives no indication of this. Can anyone confirm my suspicion, or give an example of a situation in which they would return different values?





Aucun commentaire:

Enregistrer un commentaire