A simple PHP5.3 non-deterministic state machine.