prompt()
Prompts the user for input and validates it
public static string prompt ( $text, $options = [] ) |
---|
$text | string |
Prompt string |
$options | array |
The options to validate the input: -
required : whether it is required or not -
default : default value if no input is inserted by the user -
pattern : regular expression pattern to validate user input -
validator : a callable function to validate input. The function must accept two parameters: -
input : the user input to validate -
error : the error value passed by reference if validation failed.
|
return | string |
The user input |
Please login to continue.