readline

(PHP4 >= 4.0b4)

readline -- Reads a line

Description

string readline ([string prompt])

This function returns a single string from the user. You may specify a string with which to prompt the user. The line returned has the ending newline removed. You must add this line to the history yourself using readline_add_history().

Példa 1. readline()

  1 
  2 //get 3 commands from user
  3 for($i=0; $i < 3; $i++)
  4 {
  5         $line = readline("Command: ");
  6         readline_add_history($line);
  7 }
  8 
  9 //dump history
 10 print_r(readline_list_history());
 11 
 12 //dump variables
 13 print_r(readline_info());
 14