Inetd listens for connectons on sockets.
Whenever a connection comes in on a certain port, inetd looksup which script/program should be started.
That script/program is then started and it's stdin/stdou is coupled to the socket.
That way the script/program can use stdin/stdout to talk through the socket.
That means you don't have to F-about with php's socket stuff at all, which is nice :-)