PHP Classes

File: Examples/00.readme/example.php

Recommend this page to a friend!
  Classes of Christian Vigh   PHP Command Line Arguments Parser   Examples/00.readme/example.php   Download  
File: Examples/00.readme/example.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/00.readme/example.php
Date: 11 months ago
Size: 961 bytes


Class file image Download

        Script described in the top-level file.


    // Step 1 : include the main file, CL.php
require ( '../' ) ;

// Step 2 : Define the specifications of your command line
$definitions = <<<END
        A script that displays the value of its -string_value argument.

    <string name="string_value, sv" default="default string value">
        A string value.

// Step 3 : Instantiate a CLParser object, providing the above definitions
$cl = new CLParser ( $definitions ) ;

// Step 4 : Retrieve and use the supplied parameter values the way you like
echo "The value of the string_value parameter is : " . $cl -> string_value . "\n" ;