Add comments to PHP file

I added some comments to the PHP file to make what is happening more clear.