3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getRemoteAddr() { if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR']) { if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) { $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); return $ips[0]; } else return $_SERVER['HTTP_X_FORWARDED_FOR']; } return $_SERVER['REMOTE_ADDR']; } list($rn1, $rn2) = explode(".",getRemoteAddr()); var_dump($rn1); echo "\n"; var_dump($rn2);
Output for 5.3.0 - 7.1.0
Notice: Undefined index: REMOTE_ADDR in /in/T4bRq on line 14 Notice: Undefined offset: 1 in /in/T4bRq on line 16 string(0) "" NULL
Output for 4.3.0 - 5.2.17
Notice: Undefined index: REMOTE_ADDR in /in/T4bRq on line 14 Notice: Undefined offset: 1 in /in/T4bRq on line 16 string(0) "" NULL