180 links
BigBrainBag
Home
Login
RSS Feed
Tag cloud
Picture wall
Daily
Links per page:
20
50
100
page 1 / 1
1 results tagged
input
x
terminal - How to read console/user input in PHP? - Stack Overflow
If you don't have readline installed, -or- you're writing a library, you should do this:
if (!function_exists('readline')) {
function readline($question)
{
$fh = fopen('php://stdin', 'r');
echo $question;
$userInput = trim(fgets($fh));
fclose($fh);
return $userInput;
}
}
$age = readline('What is your age? ');
echo "You are $age years old.\n";
Fri Mar 12 17:57:29 2021
- permalink
-
-
-
https://stackoverflow.com/questions/23622141/how-to-read-console-user-input-in-php
input
php
readline
shell
Links per page:
20
50
100
page 1 / 1