What is the function to retrieve a user's IP address in PHP?

To retrieve a user's IP address in PHP, you can use the `$_SERVER['REMOTE_ADDR']` variable. This variable contains the IP address of the user making the request to the server. You can use this variable to capture and store the user's IP address for various purposes, such as logging or tracking user activity.

$user_ip = $_SERVER['REMOTE_ADDR'];
echo "User's IP Address: " . $user_ip;