PhpRiot
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

Declaring Options with the Short Syntax

Zend_Console_Getopt supports a compact syntax similar to that used by GNU Getopt (see http://www.gnu.org/software/libc/manual/html_node/Getopt.html. This syntax supports only single-character flags. In a single string, you type each of the letters that correspond to flags supported by your application. A letter followed by a colon character (:) indicates a flag that requires a parameter.

Example 126. Using the Short Syntax

<?php
$opts 
= new Zend_Console_Getopt('abp:');

The example above shows using Zend_Console_Getopt to declare that options may be given as -a, -b, or -p. The latter flag requires a parameter.

The short syntax is limited to flags of a single character. Aliases, parameter types, and help strings are not supported in the short syntax.

Zend Framework