Best way to get user ip address in php

5 Years ago PHP(Functions) 0(Disable)

Here is a function to getting ip using filter of local and lan ip's.

function get_ip()
   $list = array( 'REMOTE_ADDR', 'CLIENT_IP', 'HTTP_CLIENT_IP', 
                  'X_FORWARDED', 'HTTP_VIA', 'VIA' );
   foreach ( $list as $v ) {
      if ( isset( $_SERVER[$v] ) )
         return $_SERVER[$v];
   return false;
echo get_ip();


No tag here.

Recommended pages

File size calculator...

File size calculator function return file size format into kb, mb or gb. function file_size($size, $out = 'kb', $precision = 2) { switch ($out) { case 'kb': return round($...

Change timestamp to custom format...

Use this function for change timestamp to custom format......

Number Format...

Format a number with grouped thousands......

Detect file extension function...

This function is used to find the file extension also you can use pathinfo() function for get information about a file path. function ext($file_name) { return substr($file_name, strrpos($fi...