Trying to make a socket server in PHP, not going well.

I understand the logistics behind a socket server that;

Creates a master listening socket, passes off subsequent connections to socket instances, and the script remains in a loop while(true){} waiting on user input from a terminal client, executing commands via a conditional statement on a CRLF (or just LF) and perhaps terminating the loop and closing the socket on certain conditions.

Turning off script timeout is obviously necessary, etc., so I do understand the fundamentals, but I can't find a resource or tutorial to build of from (or one that seems to work anyways)

I'm running a XAMPP server on Windows XP, and have made minimal customizations to the configuration files. (I've enabled some extensions for other projects, but nothing that would clash or cause issue.)

I hate to ask this but can someone provide me an up-to-date super simple example script (or link to one) that creates a listening socket and maintains terminal connections, perhaps simply echoing input back to the client?

I'd post some code, but I don't really have anything at all (anything that even works)

Any help is much appreciated.