Page 1 of 1

PHP-Cli Help

Posted: Tue Aug 13, 2002 3:56 pm
by cigy23
I have been working more and more with the command line php on UNIX and find myself wanting some kind of promt feature.

If this can even be done yet with the command line php can someone please give a few links to read or a quick exp of a script that would print: what is your name...then echo hello $name

Thanks

Posted: Tue Aug 13, 2002 4:04 pm
by llimllib
i googled it and found a result in about 2 minutes.

Posted: Tue Aug 13, 2002 4:04 pm
by volka
Chapter 25. Using PHP from the command line and

Code: Select all

<?php
$stdin = fopen('php://stdin', 'r');
print('name :');
$n = fgets($stdin, 64);
print("Hi, $n");
?>

Posted: Tue Aug 13, 2002 4:05 pm
by llimllib
beat you to it, volk, but not by much - google 1, manual 0

</sarcasm>

Posted: Tue Aug 13, 2002 4:08 pm
by volka
merde :wink:
but to be beaten by google is no shame :D