changing Events to php