3v4l.org

run code in 300+ PHP versions simultaneously
<?php // --------------------------- DETECT CITY BY IP --------------------------- // function detect_city($ip) { $default = 'UNKNOWN'; if (!is_string($ip) || strlen($ip) < 1 || $ip == '127.0.0.1' || $ip == 'localhost') $ip = '8.8.8.8'; $curlopt_useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)'; $url = 'http://ipinfodb.com/ip_locator.php?ip=' . urlencode($ip); $ch = curl_init(); $curl_opt = array( CURLOPT_FOLLOWLOCATION => 1, CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_USERAGENT => $curlopt_useragent, CURLOPT_URL => $url, CURLOPT_TIMEOUT => 1, CURLOPT_REFERER => 'http://' . $_SERVER['HTTP_HOST'], ); curl_setopt_array($ch, $curl_opt); $content = curl_exec($ch); if (!is_null($curl_info)) { $curl_info = curl_getinfo($ch); } curl_close($ch); if ( preg_match('{<li>City : ([^<]*)</li>}i', $content, $regs) ) { $city = $regs[1]; } if ( preg_match('{<li>State/Province : ([^<]*)</li>}i', $content, $regs) ) { $state = $regs[1]; } if( $city!='' && $state!='' ){ $location = $city . ', ' . $state; return $location; }else{ return $default; } } $ip = '87.224.117.53'; echo detect_city($ip); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.40.0110.00318.97
8.3.30.0110.00318.80
8.3.20.0040.00418.77
8.3.10.0040.00418.73
8.3.00.0050.00319.38
8.2.170.0070.00722.96
8.2.160.0080.00818.81
8.2.150.0030.00524.18
8.2.140.0070.00724.66
8.2.130.0000.00826.16
8.2.120.0040.00421.07
8.2.110.0030.00722.13
8.2.100.0030.01217.84
8.2.90.0000.00817.93
8.2.80.0050.00317.97
8.2.70.0070.00317.63
8.2.60.0040.00717.79
8.2.50.0000.00818.07
8.2.40.0060.00319.57
8.2.30.0080.00317.86
8.2.20.0050.00517.71
8.2.10.0000.00917.78
8.2.00.0060.00317.88
8.1.270.0030.00623.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0120.00017.35
8.1.230.0110.00018.83
8.1.220.0000.00917.76
8.1.210.0030.00618.77
8.1.200.0060.00317.23
8.1.190.0050.00517.22
8.1.180.0050.00318.10
8.1.170.0040.00418.82
8.1.160.0040.00318.98
8.1.150.0040.00418.62
8.1.140.0000.00817.42
8.1.130.0070.00017.50
8.1.120.0040.00417.42
8.1.110.0040.00417.45
8.1.100.0070.00017.46
8.1.90.0040.00417.52
8.1.80.0000.00817.41
8.1.70.0050.00317.40
8.1.60.0060.00317.64
8.1.50.0070.00017.48
8.1.40.0090.00017.44
8.1.30.0000.00817.60
8.1.20.0040.00417.69
8.1.10.0040.00417.53
8.1.00.0030.00617.54
8.0.300.0030.00618.77
8.0.290.0000.00816.88
8.0.280.0000.00918.54
8.0.270.0000.00717.38
8.0.260.0030.00316.93
8.0.250.0080.00016.98
8.0.240.0060.00317.11
8.0.230.0020.00517.09
8.0.220.0040.00416.97
8.0.210.0070.00017.05
8.0.200.0000.00717.06
8.0.190.0000.00817.07
8.0.180.0000.00717.02
8.0.170.0000.00916.92
8.0.160.0070.00016.91
8.0.150.0040.00416.94
8.0.140.0000.00816.95
8.0.130.0000.00513.45
8.0.120.0000.00816.97
8.0.110.0040.00416.92
8.0.100.0050.00316.89
8.0.90.0040.00417.06
8.0.80.0070.01116.96
8.0.70.0040.00416.97
8.0.60.0040.00416.86
8.0.50.0030.00717.07
8.0.30.0110.00617.09
8.0.20.0050.01417.23
8.0.10.0000.00717.04
8.0.00.0100.01016.89
7.4.330.0000.00513.16
7.4.320.0050.00216.51
7.4.300.0030.00316.71
7.4.290.0050.00516.48
7.4.280.0040.00416.48
7.4.270.0080.00016.61
7.4.260.0060.00013.29
7.4.250.0040.00416.65
7.4.240.0070.00016.57
7.4.230.0000.00816.75
7.4.220.0100.01016.61
7.4.210.0070.00716.69
7.4.200.0040.00416.65
7.4.190.0080.00016.75
7.4.160.0080.00816.63
7.4.150.0310.00716.46
7.4.140.0120.00917.86
7.4.130.0190.00716.67
7.4.120.0080.00916.61
7.4.110.0090.01016.61
7.4.100.0070.01016.55
7.4.90.0120.00616.79
7.4.80.0110.00719.39
7.4.70.0130.01016.75
7.4.60.0060.00916.54
7.4.50.0000.00716.58
7.4.40.0100.01016.58
7.4.30.0030.01316.58
7.4.00.0090.00815.06
7.3.330.0000.00613.32
7.3.320.0060.00013.39
7.3.310.0070.00016.41
7.3.300.0040.00416.31
7.3.290.0050.01316.43
7.3.280.0070.01416.42
7.3.270.0090.00916.42
7.3.260.0190.01816.75
7.3.240.0170.00716.47
7.3.230.0140.01016.41
7.3.210.0100.00716.52
7.3.200.0110.01116.46
7.3.190.0120.00916.56
7.3.180.0060.00916.64
7.3.170.0100.00716.52
7.3.160.0090.00616.37
7.3.120.0050.01214.92
7.3.110.0070.01115.04
7.3.100.0030.01415.05
7.3.90.0100.00314.89
7.3.80.0030.00714.70
7.3.70.0000.01114.72
7.3.60.0090.00314.91
7.3.50.0000.00814.79
7.3.40.0130.00314.38
7.3.30.0030.00614.79
7.3.20.0070.00316.51
7.3.10.0080.00416.54
7.3.00.0030.00916.62
7.2.330.0130.00716.76
7.2.320.0070.01516.77
7.2.310.0030.01416.55
7.2.300.0080.00916.81
7.2.290.0030.01716.72
7.2.250.0030.01015.27
7.2.240.0150.00414.88
7.2.230.0040.01114.93
7.2.220.0100.00715.03
7.2.210.0070.00715.29
7.2.200.0030.01015.09
7.2.190.0030.00714.81
7.2.180.0070.00714.78
7.2.170.0070.01114.45
7.2.160.0060.00614.85
7.2.150.0070.01116.82
7.2.140.0040.01116.54
7.2.130.0050.01116.97
7.2.120.0060.01116.74
7.2.110.0060.01017.00
7.2.100.0130.01016.96
7.2.90.0060.01016.84
7.2.80.0050.01216.76
7.2.70.0090.00516.99
7.2.60.0070.00816.94
7.2.50.0020.01416.80
7.2.40.0070.00716.71
7.2.30.0080.00616.97
7.2.20.0050.00916.92
7.2.10.0050.00816.92
7.2.00.0050.00916.89
7.1.330.0100.01015.93
7.1.320.0030.00915.91
7.1.310.0000.01215.55
7.1.300.0070.00715.41
7.1.290.0060.00615.53
7.1.280.0100.00615.78
7.1.270.0000.01415.49
7.1.260.0110.00715.61
7.1.250.0040.00715.62
7.1.240.0060.00615.56
7.1.230.0120.00315.89
7.1.220.0090.00615.92
7.1.210.0090.00315.75
7.1.200.0080.00515.69
7.1.190.0000.01315.54
7.1.180.0030.00715.73
7.1.170.0060.00915.75
7.1.160.0100.00715.92
7.1.150.0040.00815.91
7.1.140.0040.00415.43
7.1.130.0100.00315.63
7.1.120.0100.00315.50
7.1.110.0030.00615.65
7.1.100.0000.01415.83
7.1.90.0030.00915.83
7.1.80.0000.01615.53
7.1.70.0080.00316.54
7.1.60.0080.00817.52
7.1.50.0190.00725.04
7.1.40.0040.00815.72
7.1.30.0100.00715.91
7.1.20.0000.01415.73
7.1.10.0040.00715.72
7.1.00.0030.02418.99
7.0.330.0000.01415.52
7.0.320.0030.01015.21
7.0.310.0060.01015.38
7.0.300.0070.00615.42
7.0.290.0040.01115.55
7.0.280.0080.00415.54
7.0.270.0070.00715.13
7.0.260.0030.00915.57
7.0.250.0040.00815.51
7.0.240.0030.00915.64
7.0.230.0060.00915.35
7.0.220.0100.00715.18
7.0.210.0060.01015.59
7.0.200.0030.00615.99
7.0.190.0110.00315.36
7.0.180.0070.00714.83
7.0.170.0000.01115.30
7.0.160.0070.01115.02
7.0.150.0070.01015.59
7.0.140.0030.03818.68
7.0.130.0040.00715.55
7.0.120.0030.03218.68
7.0.110.0050.03317.56
7.0.100.0110.04017.47
7.0.90.0020.03217.61
7.0.80.0050.04717.69
7.0.70.0140.03917.54
7.0.60.0100.04017.43
7.0.50.0060.03818.10
7.0.40.0050.04716.74
7.0.30.0120.04016.67
7.0.20.0080.04516.89
7.0.10.0090.03516.72
7.0.00.0110.03916.63
5.6.400.0040.01213.96
5.6.390.0030.00514.58
5.6.380.0030.00614.66
5.6.370.0100.00313.98
5.6.360.0080.00314.45
5.6.350.0030.01014.40
5.6.340.0070.00714.45
5.6.330.0060.00614.42
5.6.320.0070.00714.09
5.6.310.0100.00614.65
5.6.300.0060.01214.50
5.6.290.0000.01114.36
5.6.280.0080.03717.44
5.6.270.0030.01014.32
5.6.260.0040.00914.05
5.6.250.0070.04317.29
5.6.240.0080.04017.61
5.6.230.0100.03917.42
5.6.220.0050.04317.32
5.6.210.0100.03517.34
5.6.200.0100.03817.59
5.6.190.0050.03517.62
5.6.180.0100.04217.74
5.6.170.0030.04817.68
5.6.160.0050.04317.68
5.6.150.0050.04117.84
5.6.140.0070.04617.67
5.6.130.0070.04217.72
5.6.120.0040.03917.74
5.6.110.0020.04817.74
5.6.100.0080.03817.69
5.6.90.0050.04317.67
5.6.80.0100.04117.49
5.6.70.0070.04517.25
5.6.60.0030.04417.31
5.6.50.0080.04317.35
5.6.40.0080.04017.29
5.6.30.0050.04717.51
5.6.20.0040.02817.48
5.6.10.0050.04217.19
5.6.00.0080.04217.48
5.5.380.0080.04517.41
5.5.370.0050.04817.37
5.5.360.0050.04217.48
5.5.350.0070.04517.36
5.5.340.0030.02617.54
5.5.330.0040.04517.54
5.5.320.0050.03317.59
5.5.310.0090.03217.45
5.5.300.0100.03517.55
5.5.290.0040.03417.48
5.5.280.0080.04017.36
5.5.270.0050.04817.41
5.5.260.0080.04117.64
5.5.250.0140.04117.33
5.5.240.0050.03917.07
5.5.230.0080.04417.32
5.5.220.0080.03817.07
5.5.210.0100.03817.29
5.5.200.0080.04217.19
5.5.190.0100.03517.29
5.5.180.0090.04017.36
5.5.170.0030.01014.11
5.5.160.0070.04617.35
5.5.150.0070.04216.96
5.5.140.0050.03317.13
5.5.130.0150.03517.10
5.5.120.0080.03817.30
5.5.110.0100.02517.08
5.5.100.0070.04017.11
5.5.90.0100.02417.17
5.5.80.0070.04417.03
5.5.70.0050.04317.24
5.5.60.0100.03817.01
5.5.50.0120.02117.05
5.5.40.0050.04617.07
5.5.30.0070.03416.87
5.5.20.0120.03117.15
5.5.10.0080.04117.16
5.5.00.0030.04317.03
5.4.450.0080.03815.13
5.4.440.0080.03815.24
5.4.430.0080.03315.30
5.4.420.0070.03915.16
5.4.410.0070.03915.18
5.4.400.0020.04015.22
5.4.390.0050.04215.00
5.4.380.0080.03715.11
5.4.370.0100.03415.04
5.4.360.0120.03415.08
5.4.350.0080.04115.05
5.4.340.0080.03714.84
5.4.330.0070.00010.75
5.4.320.0050.04115.08
5.4.310.0080.02515.08
5.4.300.0070.03015.12
5.4.290.0060.03915.06
5.4.280.0070.03715.16
5.4.270.0030.04014.90
5.4.260.0060.03815.06
5.4.250.0070.04015.03
5.4.240.0130.03314.96
5.4.230.0110.04115.08
5.4.220.0050.04314.98
5.4.210.0050.04015.00
5.4.200.0100.03514.85
5.4.190.0050.03914.97
5.4.180.0070.04214.87
5.4.170.0030.04115.18
5.4.160.0020.04315.26
5.4.150.0060.04315.05
5.4.140.0050.04213.71
5.4.130.0030.03813.70
5.4.120.0050.04313.67
5.4.110.0100.02813.85
5.4.100.0020.04513.87
5.4.90.0030.04213.66
5.4.80.0030.03513.60
5.4.70.0070.03013.62
5.4.60.0080.03513.79
5.4.50.0050.02613.78
5.4.40.0090.03513.81
5.4.30.0130.03513.78
5.4.20.0060.02513.49
5.4.10.0090.03913.71
5.4.00.0050.03313.50
5.3.290.0070.04212.76
5.3.280.0140.03012.61
5.3.270.0080.03812.61
5.3.260.0070.04012.61
5.3.250.0070.03812.58
5.3.240.0050.03712.46
5.3.230.0090.02512.51
5.3.220.0030.03812.48
5.3.210.0030.04012.51
5.3.200.0130.03512.56
5.3.190.0070.03912.71
5.3.180.0050.04312.45
5.3.170.0050.04112.65
5.3.160.0030.03912.70
5.3.150.0120.01912.68
5.3.140.0070.03712.60
5.3.130.0030.04212.50
5.3.120.0050.03212.52
5.3.110.0050.04312.48
5.3.100.0050.02312.21
5.3.90.0080.03812.39
5.3.80.0030.04212.14
5.3.70.0050.04312.18
5.3.60.0030.04012.33
5.3.50.0060.03812.17
5.3.40.0030.03012.27
5.3.30.0000.03512.26
5.3.20.0080.03512.07
5.3.10.0100.03711.92
5.3.00.0050.04011.91
5.2.170.0170.05011.14
5.2.160.0030.05311.13
5.2.150.0030.06311.16
5.2.140.0070.06311.13
5.2.130.0000.06311.20
5.2.120.0100.04711.25
5.2.110.0100.05011.12
5.2.100.0030.05011.26
5.2.90.0070.06011.20
5.2.80.0030.04011.10
5.2.70.0100.05711.17
5.2.60.0130.02711.04
5.2.50.0000.03711.00
5.2.40.0000.03710.98
5.2.30.0030.06310.98
5.2.20.0130.05010.83
5.2.10.0030.06711.00
5.2.00.0070.05710.70
5.1.60.0130.02310.18
5.1.50.0070.0509.98
5.1.40.0030.04310.00
5.1.30.0030.05010.51
5.1.20.0100.04310.37
5.1.10.0130.0479.91
5.1.00.0070.05310.14
5.0.50.0030.0438.54
5.0.40.0100.0408.35
5.0.30.0030.0608.35
5.0.20.0030.0438.35
5.0.10.0030.0478.35
5.0.00.0070.0578.35
4.4.90.0000.0308.35
4.4.80.0030.0278.35
4.4.70.0000.0378.35
4.4.60.0030.0338.35
4.4.50.0000.0338.35
4.4.40.0000.0508.35
4.4.30.0030.0178.35
4.4.20.0070.0338.35
4.4.10.0000.0278.35
4.4.00.0030.0338.35
4.3.110.0030.0378.35
4.3.100.0000.0338.35
4.3.90.0070.0308.35
4.3.80.0000.0378.35
4.3.70.0000.0378.35
4.3.60.0000.0278.35
4.3.50.0070.0308.35
4.3.40.0000.0408.35
4.3.30.0000.0338.35
4.3.20.0000.0278.35
4.3.10.0000.0378.35
4.3.00.0000.0378.35

preferences:
46.98 ms | 400 KiB | 5 Q