Query: readline_callback_handler_install
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
READLINE_CALLBACK_HANDLER_INSTALL(3) 1 READLINE_CALLBACK_HANDLER_INSTALL(3) readline_callback_handler_install - Initializes the readline callback interface and terminal, prints the prompt and returns immediatelySYNOPSISbool readline_callback_handler_install (string $prompt, callable $callback)DESCRIPTIONSets up a readline callback interface then prints $prompt and immediately returns. Calling this function twice without removing the previ- ous callback interface will automatically and conveniently overwrite the old interface. The callback feature is useful when combined with stream_select(3) as it allows interleaving of IO and user input, unlike readline(3).PARAMETERSo $prompt - The prompt message. o $callback - The $callback function takes one parameter; the user input returned.RETURN VALUESReturns TRUE on success or FALSE on failure. Example #1 Readline Callback Interface Example <?php function rl_callback($ret) { global $c, $prompting; echo "You entered: $ret "; $c++; if ($c > 10) { $prompting = false; readline_callback_handler_remove(); } else { readline_callback_handler_install("[$c] Enter something: ", 'rl_callback'); } } $c = 1; $prompting = true; readline_callback_handler_install("[$c] Enter something: ", 'rl_callback'); while ($prompting) { $w = NULL; $e = NULL; $n = stream_select($r = array(STDIN), $w, $e, null); if ($n && in_array(STDIN, $r)) { // read a character, will call the callback when a newline is entered readline_callback_read_char(); } } echo "Prompting disabled. All done. "; ?> readline_callback_handler_remove(3), readline_callback_read_char(3), stream_select(3). PHP Documentation Group READLINE_CALLBACK_HANDLER_INSTALL(3)
Related Man Pages |
---|
sasl_chalprompt_t(3sasl) - sunos |
array_map(3) - php |
array_walk(3) - php |
eio_custom(3) - php |
gupnp_control_point_callback_set(3) - php |
Similar Topics in the Unix Linux Community |
---|
Need quick help |
How to display an error msg? |
grub, ok, bash, edit, kmdb and what else? |
Nohup not returns to the prompt |
How to prompt user to define a variable? |