3v4l.org

run code in 300+ PHP versions simultaneously
<?php function visitor_country() { $ip = $_SERVER["REMOTE_ADDR"]; if(filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; if(filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_CLIENT_IP']; $result = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)) ->geoplugin_countryName; return $result <> NULL ? $result : "Unknown"; } echo visitor_country(); // Output Coutry name [Ex: United States] ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "REMOTE_ADDR" in /in/p9glH on line 4 Unknown

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:
60.43 ms | 401 KiB | 8 Q