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).