Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Adding Help Messages

In addition to specifying the help strings when declaring option rules in the long format, you can associate help strings with option rules using the setHelp() method. The argument to the setHelp() method is an associative array, in which the key is a flag, and the value is a corresponding help string.

Example 133. Using setHelp()

= new Zend_Console_Getopt('abp:');
'a' => 'apple option, with no parameter',
'b' => 'banana option, with required integer parameter',
'p' => 'pear option, with optional string parameter'

If you declared options with aliases, you can use any of the aliases as the key of the associative array.

The setHelp() method is the only way to define help strings if you declared the options using the short syntax.

Zend Framework