note 105437 added to function.ncurses-getch
| From: | kermodebear at gmail dot com | Date: | Thu, 18 Aug 2011 02:28:54 +0000 |
| Subject: | note 105437 added to function.ncurses-getch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182553@lists.php.net to get a copy of this message | ||
The original ncurses getstr function isn't available. It reads input until a CR or LF is
reached.
This function is a drop-in replacement that should have the exact same functionality.
<?php
function ncurses_getstr() {
$result = '';
while (!in_array($input = ncurses_getch(), array(10, 13))) {
$result .= chr($input);
}
return $result;
}
?>
Note that this will capture control characters and whatnot, so make sure to filter the returned
string accordingly.
----
Server IP: 69.147.83.197
Probable Submitter: 173.89.164.176
----
Manual Page -- http://www.php.net/manual/en/function.ncurses-getch.php
Edit -- https://master.php.net/note/edit/105437
Del: integrated -- https://master.php.net/note/delete/105437/integrated
Del: useless -- https://master.php.net/note/delete/105437/useless
Del: bad code -- https://master.php.net/note/delete/105437/bad+code
Del: spam -- https://master.php.net/note/delete/105437/spam
Del: non-english -- https://master.php.net/note/delete/105437/non-english
Del: in docs -- https://master.php.net/note/delete/105437/in+docs
Del: other reasons-- https://master.php.net/note/delete/105437
Reject -- https://master.php.net/note/reject/105437
Search -- https://master.php.net/manage/user-notes.php