Skip to content

Instantly share code, notes, and snippets.

@aknosis
Created January 18, 2012 23:58
Show Gist options
  • Select an option

  • Save aknosis/1636629 to your computer and use it in GitHub Desktop.

Select an option

Save aknosis/1636629 to your computer and use it in GitHub Desktop.

Revisions

  1. Paul Giberson created this gist Jan 18, 2012.
    15 changes: 15 additions & 0 deletions prompt.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php
    /**
    * Usage:
    * $answer = prompt("What is your quest?");
    * echo "Answer: $answer";
    *
    * Outputs:
    * What is your quest?
    * I seek the holy grail!
    * Answer: I seek the holy grail!
    */
    function prompt($msg){
    echo "$msg\n";
    return trim(fgets(STDIN));
    }