By: Prem Tiwari | Last Updated:
Sometimes you need to get the client side the IP address to implement some features in web application using PHP programming language. In this tutorial, we will share 2 line PHP code to get the client IP address.
Copy the below PHP code and use it inside your PHP script to print the IP address.
* get the client IP address in PHP
$ipaddress = $_SERVER['REMOTE_ADDR']
Echo "Your IP Address is " . $ipaddress;
Your IP is 22.214.171.124