An example for ya

#!/usr/local/bin/php -q
file name: shellexample.php
created by:  dan mccullough
date created: 10/26/01
purpose:  just to do a simple shell script that takes the input and places its output 
on the

For more information contact Dan McCullough at 603.444.9808

To use this on the command line type [root@ns web]# php shellexample.php
then type your line of text.
    function read() {
        $fp=fopen("/dev/stdin", "r");
        $input=fgets($fp, 255);

        return $input;

    print("Please input your text? ");
    $input = read();
    $string = $input;
    $string = preg_replace ("/(.)/", "\\1\n", $string);
    print ($string);


--- David Yee <[EMAIL PROTECTED]> wrote:
> Can I write a command line PHP script like the following:
> php -q test.php
> Output: 
> ==================
> 1)choice A
> 2)choice B
> 3)choice C
> Please enter an option: 1
> ==================
> Thanks.
> David

Dan McCullough
"Theres no such thing as a problem unless the servers are on fire!"
h: 603.444.9808
w: McCullough Family
w: At Work

Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to