How to get Client IP Address in PHP

PHP Extract client information from the web server and stored in $_SERVER array. We can get the client IP address from the $_SERVER array by using "REMOTE_ADDR" argument.

$client_ip = $_SERVER["REMOTE_ADDR"];
echo $client_ip;

We can write a simple function which will print the client IP Address.

function php_get_ip_address_of_client(){
$client_ipaddress = $_SERVER["REMOTE_ADDR"];
echo "IP Address of the Client is : ".$client_ipaddress;