Sometimes you may need to update php version in hostgator. To update your php version follow the below steps
Step 1: Login into your HostGator
Step 2: Access your CPanel
Step 3: Go to Websites and and scroll down to Software
Step 4: And in the software,select PHP selector

Step 5: In the PHP Selector, change the PHP version as shown
Step 6: Select the PHP version in the dropdown and click on “OK”
