PEAR Handbuch | ||
---|---|---|
Zurück | Nach vorne |
Safely read the $argv PHP array across different PHP configurations. Will take care on register_globals and register_argc_argv ini directives
Returns
mixed - array or PEAR_Error if not registered
Beispiel 1. Using
|
parses the command-line options
Parameter
$args - an array of command-line arguments
$shortoptions - specifies the list of allowed short options. See the "Options" section.
$longoptions - specifies the list of allowed long options. Default is NULL. See the "Options" section.
Returns
mixed - two-element array containing the list of parsed options and the non-option arguments or PEAR_Error
Getopt() support two types of options: short options and long options
Beispiel 2. Calling a script with short and long options
The long options work equal, but you have to define them in an array
|
The return value is an array of two elements: the list of parsed options and the list of non-option command-line arguments. Each entry in the list of parsed options is a pair of elements - the first one specifies the option, and the second one specifies the option argument, if there was one, else the value is NULL.
Zurück | Zum Anfang | Nach vorne |
PEAR Console | Nach oben | PEAR DB: a unified API for accessing SQL-databases |