PHP Doku:: Checks if optional - reflectionparameter.isoptional.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzVariablen- und typbezogene ErweiterungenReflectionThe ReflectionParameter classReflectionParameter::isOptional

Ein Service von Reinhard Neidl - Webprogrammierung.

The ReflectionParameter class

<<ReflectionParameter::isDefaultValueAvailable

ReflectionParameter::isPassedByReference>>

ReflectionParameter::isOptional

(PHP 5 >= 5.0.3)

ReflectionParameter::isOptionalChecks if optional

Beschreibung

public bool ReflectionParameter::isOptional ( void )

Checks if the parameter is optional.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

TRUE if the parameter is optional, otherwise FALSE

Siehe auch


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
artkurapov at gmail dot com
9.02.2010 16:26
Lets say you have method defined

function read_me( a,b,c=1,d,e=2,f=3){}

then reading argument "c" to be optional, it will actually give you false (or nothing at all). This is probably a bug that counts number of required arguments, assuming you have put all optional to the end.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)