Google News
logo
Zend framework - Interview Questions
What about Declaring Getopt Rules in Zend framework?
The constructor for the Zend\Console\Getopt class takes from one to three arguments. The first argument declares which options are supported by your application. This class supports alternative syntax forms for declaring the options. See the sections below for the format and usage of these syntax forms.
 
The constructor takes two more arguments, both of which are optional. The second argument may contain the command-line arguments. This defaults to $_SERVER['argv'].
 
The third argument of the constructor may contain an configuration options to customize the behavior of Zend\Console\Getopt. See Adding Configuration for reference on the options available.
 
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.
 
Using the Short Syntax : 

$opts = new Zend\Console\Getopt('abp:');
Advertisement