Console_Getopt::getopt

Console_Getopt::getopt -- fetch the command-line options

Referentiesamenvatting

require_once 'Console/Getopt.php';

array getopt (array $args, string $shortoptions [, array $longoptions = NULL])

Beschrijving

Parses the command-line options and returns them.

Parameter

Return waarde

array - two-element array containing the list of parsed options and the non-option arguments or a PEAR_Error.

Throws

Tabel 33-1. Mogelijke PEAR_Error waarden

Error codeError messageReasonSolution
NULL "Console_Getopt: option --$opt is ambiguous" Two or more long options starts with the same character. Change the naming of the options. It is also possible that the error is caused by a typing mistake.
NULL "Console_Getopt: option --$opt requires an argument" No parameter for a option was given. Normally this is a user mistake. If the parameter is optional, you have to markup the parameter as optional in the option definitions.
NULL "Console_Getopt: option --$opt doesn't allow an argument" A parameter for a option was given. Normally this is a user mistake. If the option requires a (optional) parameter, you have to markup it in the options definition.
NULL "Console_Getopt: unrecognized option --$opt" Unknown option. Normally this is a user mistake. If the option exists, you have to define them in the options definition.

Note

Deze functie kan niet statisch worden aangeroepen.