PHP Reactive Programming by Martin Sikora

PHP Reactive Programming by Martin Sikora

Author:Martin Sikora [Sikora, Martin]
Language: eng
Format: azw3, epub
Publisher: Packt Publishing
Published: 2017-03-24T04:00:00+00:00


Each array is passed by reference, so we can't leave it with just []; we need to pass it as a variable (null is also acceptable). The last integer parameter 5 is the timeout after which this function returns, even though it didn't catch any activity on any of its streams.

So in this example, we create a resource $stdin using fopen(), then wait for five seconds for any user input (the data is sent to the buffer by terminal after we press the Enter key) and then use fgets() to get the data from buffer and print it in reversed order.

Notice that we had to make the $stdin stream nonblocking anyway. If we didn't, the stream_select() would never end, regardless the timeout.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.