You can use the getOption() method to query the value
of an option. If the option had a parameter, this method returns
the value of the parameter. If the option had no parameter but
the user did specify it on the command-line, the method returns
TRUE. Otherwise the method returns NULL.
Example 125. Using getOption()
<?php
$opts = new Zend_Console_Getopt('abp:');
$b = $opts->getOption('b');
$p_parameter = $opts->getOption('p');
Alternatively, you can use the magic __get() function
to retrieve the value of an option as if it were a class member
variable. The __isset() magic method is also
implemented.
Example 126. Using __get() and __isset() Magic Methods
<?php
$opts = new Zend_Console_Getopt('abp:');
if (isset($opts->b)) {
echo "I got the b option.\n";
}
$p_parameter = $opts->p; // null if not set
If your options are declared with aliases, you may use any of the aliases for an option in the methods above.




