PHP Classes

File: hello.php

Recommend this page to a friend!
  Classes of Jonathan Gotti   Console App   hello.php   Download  
File: hello.php
Role: Example script
Content type: text/plain
Description: example
Class: Console App
Parse and retrieve command line argument values
Author: By
Last change:
Date: 18 years ago
Size: 504 bytes
 

Contents

Class file image Download
<?php
require_once('console_app.php');
# set the app
$app = &new console_app();
$app->set_app_desc("This is a famous Hello World console app.");

# set some command line parameters
$app->define_arg('name','n','','your name');

# don't forget to parse the command line to get args
$app->parse_args();

# get the value of 'name' like this
$name = $app->get_arg('name');
if(
$name =='' )
 
$name = $app->read("enter your name");

# display a hello msg
$app->msg("Hello $name",'blue');
?>