On the sitepoint blog Bruno Skvorc explains some of the inner works of the PHP version of snake created by Andrew Carter.

At a recent conference in Bulgaria, there was a hackathon for which Andrew Carter created a PHP console version of the popular “snake” game. I thought it was a really interesting concept, and since Andrew has a history of using PHP for weird things, I figured I’d demystify and explain how it was done.

https://www.sitepoint.com/howd-they-do-it-phpsnake-detecting-keypresses/