Created
July 18, 2018 13:39
-
-
Save matthewpoer/6bfcb6646cda2001b9e209ce863de4e7 to your computer and use it in GitHub Desktop.
Using `fgets` to solicit and obtain user input in PHP CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "What do you want?" . PHP_EOL; | |
$handle = fopen("php://stdin","r"); | |
$input = fgets($handle); | |
echo "You want " . $input . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment