Readline

readline is the PHP extension to the GNU Readline library. This library provide features to interact with the command line, and its prompt.

<?php

    // read 3 commands from user
    for ($i=0; $i < 3; $i++) {
            $line = readline("Commande :");
            readline_add_history($line);
    }

    // list the command line history
    print_r(readline_list_history());

?>

Documentation

See also GNU readline, How to read user or console input in PHP, How to read user or console input in PHP ? and How To Take Input From User In PHP Without Form.

Related : Extensions, Read Eval Print Loop (REPL)