Skip to content

Instantly share code, notes, and snippets.

@superic
Last active January 3, 2016 10:09
Show Gist options
  • Save superic/8447957 to your computer and use it in GitHub Desktop.
Save superic/8447957 to your computer and use it in GitHub Desktop.
Interactive command line PHP with STDIN and STDOUT
<?php
$input = 'foo';
while(!empty($input)) {
fwrite(STDOUT, "Enter something: ");
$input = trim(fgets(STDIN));
fwrite(STDOUT, "\nYou entered: $input\n");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment