A Simple PHP Finite State Machine