PHP-Cli Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cigy23
Forum Newbie
Posts: 3
Joined: Fri Aug 09, 2002 6:08 pm

PHP-Cli Help

Post 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
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

i googled it and found a result in about 2 minutes.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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");
?>
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

beat you to it, volk, but not by much - google 1, manual 0

</sarcasm>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

merde :wink:
but to be beaten by google is no shame :D
Post Reply