Added PHP version

I've tested that the output of running it is the same as for the Python one it is based on, and tested running the unit tests.