Note that this function is blocking if there is no character to read
If you don`t want to get blocked, you should use the trick with stream_select()
It also only reads one char per call,
So if something else in your script is blocking,
you`ve got a problem