How to make an interactive shell script in PHP

Basically, the function fgets with input STDIN will cause the script to pause and wait for the user to enter some text and hit enter.

<?php
        echo "Please enter your name: ";

        $name = fgets(STDIN);

        echo "\nThanks, you entered: {$name}\n";
?>

http://www.sitepoint.com/article/php-command-line-1 »

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.