How to get the ip address of a user in php?

You can get the IP address of a user in PHP using the $_SERVER superglobal array.

Example:


  $ip_address = $_SERVER['REMOTE_ADDR'];
  

Beginner's Guide to PHP