Updated php script to be 5.2 compatible (I think)