public static function prompt($prompt, $masked=false, $limit=100)
    {
        echo "$prompt: ";
        if ($masked) {
            `stty -echo`; // disable shell echo
        }
        $buffer = '';
        $char = "";
        $f = fopen('php://stdin', 'r');
        while (strlen($buffer) < $limit) {
            $char = fread($f, 1);
            if ($char === "\n" || $char === "\r") {
                break;
            }
            $buffer.= $char;
        }
        if ($masked) {
            `stty echo`; // enable shell echo
            echo "\n";
        }
        return $buffer;
    }
public static function prompt($prompt, $masked=false, $limit=100)
    {
        echo "$prompt: ";
        if ($masked) {
            `stty -echo`; // disable shell echo
        }
        $buffer = '';
        $char = "";
        $f = fopen('php://stdin', 'r');
        while (strlen($buffer) < $limit) {
            $char = fread($f, 1);
            if ($char === "\n" || $char === "\r") {
                break;
            }
            $buffer.= $char;
        }
        if ($masked) {
            `stty echo`; // enable shell echo
            echo "\n";
        }
        return $buffer;
    }
public static function prompt ( $ prompt , $ masked = false , $ limit = 100 ) { echo "$prompt: " ; if ( $ masked ) { `stty -echo` ; // disable shell echo } $ buffer = '' ; $ char = "" ; $ f = fopen ( 'php://stdin' , 'r' ) ; while ( strlen ( $ buffer ) < $ limit ) { $ char = fread ( $ f , 1 ) ; if ( $ char === "\n" || $ char === "\r" ) { break ; } $ buffer .= $ char ; } if ( $ masked ) { `stty echo` ; // enable shell echo echo "\n" ; } return $ buffer ; }
Prompts the user for input. Optionally masking it.

@param   string  $prompt     The prompt to show the user
@param   bool    $masked     If true, the users input will not be shown. e.g. password input
@param   int     $limit      The maximum amount of input to accept
@return  string
Prompts the user for input . Optionally masking it .