PHP 4, PHP 5, PHP 7, PHP 8
readline - Reads a line
Code Examples

readline( [string|null$prompt = null] ): string|false

Reads a single line from the user. You must add this line to the history yourself using readline_add_history.



You may specify a string with which to prompt the user.

Return Values

Returns a single string from the user. The line returned has the ending newline removed. If there is no more data to read, then false is returned.

Example of readline

Show all examples for readline

PHP Version:

Function readline:

GNU Readline Functions

Most used PHP functions