You are working on a project where you need to get the user's IP address. Which of the following PHP server variables will you use?

  • $_SERVER['HTTP_USER_AGENT']
  • $_SERVER['HTTP_X_FORWARDED_FOR']
  • $_SERVER['REMOTE_ADDR']
  • $_SERVER['HTTP_REFERER']
The user's IP address is typically stored in $_SERVER['REMOTE_ADDR'] in PHP. This server variable contains the IP address of the user who is accessing the web page.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *