note 126860 added to ref.readline
| From: | jcastromail.yahoo.es via php-notes | Date: | Fri, 18 Feb 2022 18:57:47 +0000 |
| Subject: | note 126860 added to ref.readline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217627@lists.php.net to get a copy of this message | ||
Windows.
To the current date, PHP 8.1 64bits under Windows does not support all the functions:
supported:
readline_add_history
readline_clear_history
readline_completion_function
readline_info
readline_list_history
readline_read_history
readline_write_history
readline
no supported: (the function is not even defined)
readline_callback_handler_install
readline_callback_handler_remove
readline_callback_read_char
readline_on_new_line
readline_redisplay
if you want to read a key in windows (without blocking), you can use the next code:
$out='';
$ret='';
$keys='1234567890abcdefghijklmnopqrstuvwxyz'."á";
$default="á";
while(true) {
exec("choice /N /C $keys /D $default /T 1",$out,$ret);
if($out[0]!=="á") {
var_dump($out[0]);
}
$out=[];
}
It is not elegant and it calls choice every 1 second but it does the job (at least with some keys).
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 190.46.238.9)
----
Manual Page -- https://php.net/manual/en/ref.readline.php
Edit -- https://main.php.net/note/edit/126860
Del: integrated -- https://main.php.net/note/delete/126860/integrated
Del: useless -- https://main.php.net/note/delete/126860/useless
Del: bad code -- https://main.php.net/note/delete/126860/bad+code
Del: spam -- https://main.php.net/note/delete/126860/spam
Del: non-english -- https://main.php.net/note/delete/126860/non-english
Del: in docs -- https://main.php.net/note/delete/126860/in+docs
Del: other reasons-- https://main.php.net/note/delete/126860
Reject -- https://main.php.net/note/reject/126860
Search -- https://main.php.net/manage/user-notes.php