Sure . i am sharing code snippet below
NOTE : getenv() function is not supporting in my code. it's giving error on that line we are checking getenv() function. I am using PHP 5.6 as per documentation.please suggest why it's not supporting.you can see error also .