3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getRealIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip .= 'HTTP_CLIENT_IP'.$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip .= 'HTTP_X_FORWARDED_FOR'.$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip .= 'REMOTE_ADDR'.$_SERVER['REMOTE_ADDR']; } return $ip; } getRealIpAddr(); ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined index: REMOTE_ADDR in /in/2Njpm on line 14 Notice: Undefined variable: ip in /in/2Njpm on line 14
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: REMOTE_ADDR in /in/2Njpm on line 14
Output for 5.0.4 - 5.2.17
Notice: Undefined index: REMOTE_ADDR in /in/2Njpm on line 14 Notice: Undefined variable: ip in /in/2Njpm on line 14
Output for 4.3.0 - 5.0.3
Notice: Undefined index: REMOTE_ADDR in /in/2Njpm on line 14 Notice: Undefined variable: ip in /in/2Njpm on line 14