note 34237 added to features.commandline
| From: | punk at rack1 dot php dot net | Date: | Sat, 19 Jul 2003 09:18:42 +0000 |
| Subject: | note 34237 added to features.commandline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52377@lists.php.net to get a copy of this message | ||
You can use this function to ask user to enter smth
<?
function read ($length='255')
{
if (!isset ($GLOBALS['StdinPointer']))
{
$GLOBALS['StdinPointer'] = fopen ("php://stdin","r");
}
$line = fgets ($GLOBALS['StdinPointer'],$length);
return trim ($line);
}
// then
echo "Enter your name: ";
$name = read ();
echo "\nHello $name! Where you came from? ";
$where = read ();
echo "\nI see. $where is very good place.";
?>
----
Manual Page -- http://www.php.net/manual/en/features.commandline.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34237
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34237&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34237&report=yes