Hi,
try {
$opts = new Zend_Console_Getopt(array(
'id=i' = 'id option,required an integer parameter'
));
$opts-parse();
echo $opts-id;
} catch (Zend_Console_Getopt_Exception $e) {
echo $e-getMessage();
echo $e-getUsageMessage();
exit();
}
If I run this snippet
That's not exactly how the options work. How it works is if the id
parameter is passed in then an integer value is required. It won't fail if
no id parameter is passed in.
You may want to add this code after the catch block to make the id
argument required:
if (null === $opts-id) {
echo