|
| The Long And Short Of It |
The Console_Getopt class is a PEAR package that provides an API for PHP developers to capture options passed to a PHP program on the command line, and act on them within the business logic of the program. It's currently maintained by Andrei Zmievski and Stig Bakken, – both of whom are PHP core developers - and is freely available from http://pear.php.net/package/Console_Getopt, or as part of the standard PHP distribution. It goes without saying that you will also need to have PEAR itself (PEAR.php) installed in order to use this package.
Command-line options usually come in two sizes: short and long. In the short format, these options are usually preceded by a dash, as in the following example:
shell> php -h
Under the POSIX standard, it's also possible to use longer, human-readable command-line options, preceded with a double dash, as in the following example:
shell> php --help
You can also pass values to a program from the command-line interface, like this:
shell> lynx --term=VT100
The Console_Getopt class works with both short and long options, and also supports option values. The class conforms to PEAR rules on error handling and coding syntax and is, in fact, a fairly important component of PEAR: the PEAR package manager itself uses Console_Getopt for many tasks.
 |
How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system..
Read more, or grab your copy now!
|
|