Created
November 28, 2017 01:24
-
-
Save alana314/f633a58c68a7d923139b891065365133 to your computer and use it in GitHub Desktop.
Use PHP to interact with stdin
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
while(true): | |
echo "Are you sure you want to do this? Type 'yes' to continue: "; | |
$handle = fopen ("php://stdin","r"); | |
$line = fgets($handle); | |
if(trim($line) == 'yes'){ | |
break; | |
} | |
endwhile; | |
fclose($handle); | |
echo "\n"; | |
echo "Thank you, continuing...\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment