note 105437 deleted from function.ncurses-getch by danbrown

From: Date: Thu, 18 Aug 2011 16:49:47 +0000
Subject: note 105437 deleted from function.ncurses-getch by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182570@lists.php.net to get a copy of this message
Note Submitter: kermodebear at gmail dot com ---- 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.

« previous php.notes (#182570) next »