CakeFest 2025 Madrid: The Official CakePHP Conference

Voting

: four plus three?
(Example: nine)

The Note You're Voting On

alex at alexdemers dot me
16 years ago
The best and simplest way to get input from a user in the CLI with only PHP is to use fgetc() function with the STDIN constant:

<?php

echo 'Are you sure you want to quit? (y/n) ';
$input = fgetc(STDIN);

if (
$input == 'y')
{
exit(
0);
}

?>

<< Back to user notes page

To Top