a php implementation of the old classic