PHP CLI: Read User Input Without Echoing Characters (silently)
PHP Code
function UI_Line_Quiet() {
/*
Purpose
Used to get user input without echoing the typed characters to the screen.
Return (string)
Returns the entire string that the user typed.
This function returns when the user presses the Enter key.
Dependencies
This function works only within the Bash shell.
Version History
1.0 2012.04.04 Tested by Russ Tanner on PHP 5.3.10.
*/
$Cmd = "/usr/bin/env bash -c 'read -s x && echo \$x'";
return rtrim(shell_exec($Cmd));
}
The Captian Today they call you "crazy". Tomorrow they call you "ahead of your time." Global Skywatch Learn about Chemtrails - You're breathing them now! OnlyTheBestHerbs.com World-class supplements Mercury Talk Why you are sick. OneUp Domains Domains, Hosting, Email 1-800-358-4278 (U.S. & Canada)