mirror of
https://github.com/php/php-src.git
synced 2026-04-03 14:12:38 +02:00
IO and user input. Sample script:
<?php
dl("readline.so");
function handle_user_input($line)
{
echo "You typed: '$line'\n";
if ($line == 'exit')
exit;
}
readline_callback_handler_install('type! > ', 'handle_user_input');
while (true) {
$n = stream_select($r = array(STDIN), $w = null, $e = null, null);
if ($n && in_array(STDIN, $r)) {
readline_callback_read_char();
}
}
This library can be built with libedit - non-GPL drop-in readline replacement. Libedit can be obtained from http://sourceforge.net/projects/libedit/ It is taken from NetBSD (http://www.netbsd.org/) CVS repository and modified to work as stand-alone library.