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;
    }