3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ip=$_SERVER['REMOTE_ADDR']; $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if(getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if(getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWARDED'); else if(getenv('HTTP_FORWARDED_FOR')) $ipaddress = getenv('HTTP_FORWARDED_FOR'); else if(getenv('HTTP_FORWARDED')) $ipaddress = getenv('HTTP_FORWARDED'); else if(getenv('REMOTE_ADDR')) $ipaddress = getenv('REMOTE_ADDR'); else $ipaddress = 'UNKNOWN'; echo "OLD IP: "; echo $ip; echo "<br>"; echo "NEW IP: "; echo $ipaddress; echo "<br>"; echo getenv('HTTP_CLIENT_IP'); echo "<br>"; echo getenv('HTTP_X_FORWARDED_FOR'); echo "<br>"; echo getenv('HTTP_X_FORWARDED'); echo "<br>"; echo getenv('HTTP_FORWARDED_FOR'); echo "<br>"; echo getenv('HTTP_FORWARDED'); echo "<br>"; echo getenv('REMOTE_ADDR'); $file = fopen("ip.txt","a"); fwrite($file,"OLD IP: "); fwrite($file,$ip); fwrite($file," NEW IP: "); fwrite($file,$ipaddress); fwrite($file,"\n"); fclose($file); ?>
Output for git.master, git.master_jit
Warning: Undefined array key "REMOTE_ADDR" in /in/Dj036 on line 3 OLD IP: <br>NEW IP: UNKNOWN<br><br><br><br><br><br> Warning: fopen(): open_basedir restriction in effect. File(ip.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Dj036 on line 40 Warning: fopen(ip.txt): Failed to open stream: Operation not permitted in /in/Dj036 on line 40 Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /in/Dj036:41 Stack trace: #0 /in/Dj036(41): fwrite(false, 'OLD IP: ') #1 {main} thrown in /in/Dj036 on line 41
Process exited with code 255.
Output for rfc.property-hooks
Warning: Undefined array key "REMOTE_ADDR" in /in/Dj036 on line 3 OLD IP: <br>NEW IP: UNKNOWN<br><br><br><br><br><br> Warning: fopen(): open_basedir restriction in effect. File(ip.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Dj036 on line 40 Warning: fopen(ip.txt): Failed to open stream: Operation not permitted in /in/Dj036 on line 40 Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, false given in /in/Dj036:41 Stack trace: #0 /in/Dj036(41): fwrite(false, 'OLD IP: ') #1 {main} thrown in /in/Dj036 on line 41
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.79 ms | 401 KiB | 8 Q