This was mentioned by [Viorel] above but I think it warrants being repeated...
The example provided by [vardhan ( at ) rogers ( dot ) com], while otherwise exceptional, uses the value int(0) for $tv_sec which will cause the iteration to loop as fast as possible, consequently using up any available CPU time.
*** Ideally, $tv_sec should always be set to NULL ***, especially if you are using socket_select in a loop. If you must temporarily stop listening for events to perform another task, then the timeout should be as high as possible to reduce CPU strain (another note suggested preventing 100% CPU usage by setting a low $tv_usec value, which only makes the problem slightly less worse but does not solve it).
Setting the timeout to an explicit null value is basically the same as setting it to infinite. The script will only execute the while loop once every time there is an event.