Class optlist

Description

A class to make handling command line options a bit easier and more consistent.

We support the following syntaxes: programname --myoptname programname --myoptname myvalue programname --myoptname=myvalue programname -t myvalue programname --myoptname "myvalue words" In the first, only the presence of the option is required, as some kind of flag. The second has a value associated with the option, and the third is the same but using "=" as the separator. The fourth uses the old "-" prefix, and the fifth shows a string as the value.

Located in /optlist-defs.php (line 44)


	
			
Variable Summary
 mixed $optcount
 mixed $opts
 mixed $progname
Method Summary
 optlist optlist ()
 boolean opt_exists (string $optname)
 mixed opt_value (string $optname)
Variables
mixed $optcount = 0 (line 52)

Number of options

mixed $opts = array() (line 49)

Array of options

mixed $progname = "" (line 55)

The current program name

Methods
Constructor optlist (line 61)

Instantiate the optlist object. This does all the work since we expect that this is being done to process command line arguments/options.

optlist optlist ()
opt_exists (line 118)

Return status of the named option. Returns true if the option exists or false if it does not exist.

  • return: True if it exists or false if it does not.
boolean opt_exists (string $optname)
  • string $optname: Name of the option
opt_value (line 103)

Return the value of the named option. Returns the string associated with this option, or false if it does not exist.

  • return: The string value of the option, or false if not valid
mixed opt_value (string $optname)
  • string $optname: Name of the option

Documentation generated by phpDocumentor 1.3.0RC3