What is the function to retrieve the IP address of a user accessing a PHP script?

To retrieve the IP address of a user accessing a PHP script, you can use the `$_SERVER['REMOTE_ADDR']` variable. This variable contains the IP address of the client making the request to the server. You can use this variable to track the IP address of users accessing your PHP script for various purposes, such as logging or security measures.

// Retrieve the IP address of the user accessing the PHP script
$user_ip = $_SERVER['REMOTE_ADDR'];

// Output the IP address
echo "User IP Address: " . $user_ip;