PHP Classes

File: Examples/common/default.php

Recommend this page to a friend!
  Classes of Christian Vigh   PHP Command Line Arguments Parser   Examples/common/default.php   Download  
File: Examples/common/default.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Command Line Arguments Parser
Parse and extract arguments from the command line
Author: By
Last change: Update of Examples/common/default.php
Date: 11 months ago
Size: 806 bytes


Class file image Download
        This example defines a command line accepting one parameter, -string_value, with a default
        value of "hello world".

require_once ( dirname ( __FILE__ ) . '/../' ) ;

$definitions = <<<END
        Example script that demonstrates the usage of the "default" attribute.
        Run it without any parameter ; the default value will be used :

            \$ php default.php

        Then with a value specified for the -string_value parameter :

            \$ php default.php -string_value user-specified

    <string name="string_value, sv" default="hello world">
        Help for the string_value parameter.

$cl = new CLParser ( $definitions ) ;
"Value of the -string_value parameter : {$cl -> string_value}\n" ;