File: Examples/common/aliases.good.php

Recommend this page to a friend!
  Classes of Christian Vigh  >  PHP Command Line Arguments Parser  >  Examples/common/aliases.good.php  >  Download  
File: Examples/common/aliases.good.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:
Date: 4 years ago
Size: 1,084 bytes
 

Contents

Class file image Download
<?php
   
/***
        This example defines a command line accepting several parameters, each of them
        having aliases.
     ***/
   
require_once ( dirname ( __FILE__ ) . '/../examples.inc.php' ) ;

   
$definitions = <<<END
<command>
    <usage>
        This example defines a command line accepting several parameters, each of them
        having several unique aliases.
    </usage>

    <string name="string_value, strval, sv">
        Help for the string_value parameter (which can also be specified as -strval or -sv).
    </string>

    <integer name="integer_value, ival, iv">
        Help for the -integer_value parameter (which can also be specified as -ival or -iv).
    </integer>

    <float name="float_value, fval, fv">
        Help for the -float_value parameter (which can also be specified as -fval or -fv).
    </float>
</command>
END;

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


For more information send a message to info at phpclasses dot org.