Rob Young: Non-blocking I/O With PHP-MIO
Rob Young recently posted on his blog an interesting article on non-blocking I/O in PHP. He gives a pretty good explanation of what multiplexed I/O is and why you may or may not want to use it.
Before I go any further I suppose I should explain exactly what multiplexed (or non-blocking) I/O actually is. When reading from or writing to a stream PHP usually blocks until the operation is complete, however, a stream’s blocking mode can be set such that operations on streams don’t block and instead return immediately. Used correctly this technique can vastly improve performance in networked applications. This comes at the price of increased complexity and some would argue a more confusing program flow. For this reason I wouldn’t suggest it for trivial applications.
Rob goes on to give a very nice tutorial on how to use his new package, phpmio.
This isn’t really a beginner’s guide. If you are not familiar with sockets, streams and all the terminology he uses, you may want to just keep moving. However, for those working in this area, this is a great article and interesting project.

Comments
By the way, a question from someone who recently stumbled uppon comet (http://en.wikipedia.org/wiki/COMET_(programming) ): is this some sort of comet for PHP? From the description, it's not quite the same thing (quite different, actually), am I correct?
Raul
Son of a gun. Sorry about that. It’s fixed now.
I’m only vaguely familiar with Comet but from what I know, this is not the same. Comet would (in most cases) talk to a httpd server. This is more generic. It deals with stream and socket programming regardless of the port you are talking on.