A common requirement is to be able to log or store the IP address of a visitor to your website.
In order to do this, you can easily access the IP address through an environment variable.
The one that you want for the IP Address is called $REMOTE_ADDR, so you can access it like this:
<?php
$ip = $REMOTE_ADDR;
echo "Your IP address is $ip";
?>