Hi I am using PHP in CLI mode (Command Line Interface)

I would like to get the key the user types and immediately have it submitted to the program without the user having to press the return key(Enter Key)
So for example's sake I'ld like it to print the letter the user types immediately. So if the user types an "a" it immediately shows an "a" in the command prompt. How would I do this?

```
 do {  
     $selection = fgetc(STDIN);  
 fwrite(STOUT, "$selection");
 } while ( trim($selection) == '' );  

```