|
Previous Page |
Solar_Getopt |
Next Page |
populate()
Populates the options with values from $argv.
Parameters
- (array)
$argv: The argument values passed on the command line. If empty, will use $_SERVER['argv'] after shifting off its first element.
Returns
- (void)
Description
Populates the options with values from $argv.
For a given option on the command line, these values will result:
--foo-bar'foo-bar' => true--foo-bar=baz'foo-bar' => 'baz'--foo-bar="baz dib zim"'foo-bar' => 'baz dib zim'-s's' => true-s dib's' => 'dib'-s "dib zim gir"'s' => 'dib zim gir'
Short-option clusters are parsed as well, so that -fbz will result
in array('f' => true, 'b' => true, 'z' => true). Note that you cannot
pass parameters to an option in a cluster.
If an option is not defined, it will not be populated.
Options values are stored under the option key name, not the short- or long-format version of the option. For example, an option named 'foo-bar' with a short-form of 'f' will be stored under 'foo-bar'. This helps deconflict between long- and short-form aliases.