3v4l.org

run code in 300+ PHP versions simultaneously
<?php //require_once ("{$_SERVER['DOCUMENT_ROOT']}/cus/sha256.php"); $AWS_ACCESS_KEY = 'AKIAIDMODWRW3CRDO2BA'; $AWS_PRIVATE_KEY = 'kMuJRvcejqzMvmoZWsURIDKkteVTXa3ReDXQ6RqE'; $AWS_REGION = 'us-west-2'; $TOPIC_ARN_UPDATECUS = 'arn:aws:sns:us-west-2:791920038536:updateCusNumberRequest'; $endpoints = array( 'US-EAST-1' => 'sns.us-east-1.amazonaws.com', 'US-WEST-1' => 'sns.us-west-1.amazonaws.com', 'US-WEST-2' => 'sns.us-west-2.amazonaws.com', 'EU-WEST-1' => 'sns.eu-west-1.amazonaws.com', 'AP-SE-1' => 'sns.ap-southeast-1.amazonaws.com', 'AP-NE-1' => 'sns.ap-northeast-1.amazonaws.com', 'SA-EAST-1' => 'sns.sa-east-1.amazonaws.com' ); $endpoint = $endpoints[strtoupper($AWS_REGION)]; $protocol = 'https://'; $message = array( 'topic' => 'updateCusNumberRequest', 'email' => 'tetete', 'cus_id' => '123213' ); $params = array( 'TopicArn' => $TOPIC_ARN_UPDATECUS, 'Message' => php_compat_json_encode($message) ); $params['Action'] = 'Publish'; $params['AWSAccessKeyId'] = $AWS_ACCESS_KEY; $params['Timestamp'] = gmdate('Y-m-d\TH:i:s\Z'); $params['SignatureVersion'] = 2; $params['SignatureMethod'] = 'HmacSHA256'; uksort($params, 'strnatcmp'); $queryString = ''; foreach ($params as $key => $val) { $queryString .= "&{$key}=".rawurlencode($val); } $queryString = substr($queryString, 1); $requestString = "GET\n" . $endpoint."\n" . "/\n" . $queryString; $params['Signature'] = base64_encode( php_compat_hash_hmac('sha256', $requestString, $AWS_PRIVATE_KEY, true) ); $request = $protocol . $endpoint . '/?' . php_compat_http_build_query($params); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); $curlErrorNo = curl_errno($ch); $curlError = curl_error($ch); $info = curl_getinfo($ch); curl_close($ch); if ((floor($info['http_code'] / 100) == 2) === false) { if (strpos($output, '<Error>') !== FALSE) { echo "Amazon returned an XML error " . $output; } else{ if(!empty($curlErrorNo)) { echo "There was a problem executing curl" . $curlError . " - " . $curlErrorNo; } else{ echo "There was a problem executing this request " . $info['http_code']; } } } else { echo "All good!"; } /* php4 compatible functions */ function php_compat_hash_hmac($algo, $data, $key, $raw_output = false) { // Block size (byte) for MD5, SHA-1 and SHA-256. $blocksize = 64; $ipad = str_repeat("\x36", $blocksize); $opad = str_repeat("\x5c", $blocksize); if (strlen($key) > $blocksize) { $key = php_compat_hash($algo, $key, true); } else { $key = str_pad($key, $blocksize, "\x00"); } $ipad ^= $key; $opad ^= $key; return php_compat_hash($algo, $opad . php_compat_hash($algo, $ipad . $data, true), $raw_output); } function php_compat_hash($algo, $data, $raw_output = false) { $hash = 'test'; if ($raw_output) { return pack('H*', $hash); } else { echo "returnhash"; return $hash; } } //http://bit.ly/1uH6OR0 function php_compat_json_encode($a=false) { if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (is_scalar($a)) { if (is_float($a)) { // Always use "." for floats. return floatval(str_replace(",", ".", strval($a))); } if (is_string($a)) { $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')); return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"'; } else return $a; } $isList = true; for ($i = 0, reset($a); $i < count($a); $i++, next($a)) { if (key($a) !== $i) { $isList = false; break; } } $result = array(); if ($isList) { foreach ($a as $v) $result[] = php_compat_json_encode($v); return '[' . join(',', $result) . ']'; } else { foreach ($a as $k => $v) $result[] = php_compat_json_encode($k).':'.php_compat_json_encode($v); return '{' . join(',', $result) . '}'; } } //http://bit.ly/1q8GwII function php_compat_http_build_query($data, $prefix = null, $sep = '', $key = '') { $ret = array(); foreach ((array )$data as $k => $v) { $k = urlencode($k); if (is_int($k) && $prefix != null) { $k = $prefix . $k; } if (!empty($key)) { $k = $key . "[" . $k . "]"; } if (is_array($v) || is_object($v)) { array_push($ret, http_build_query($v, "", $sep, $k)); } else { array_push($ret, $k . "=" . urlencode($v)); } } if (empty($sep)) { $sep = ini_get("arg_separator.output"); } return implode($sep, $ret); } ?>

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.0070.00716.87
8.3.50.0110.01120.10
8.3.40.0180.00418.96
8.3.30.0000.01419.21
8.3.20.0050.00320.38
8.3.10.0080.00023.71
8.3.00.0000.00919.27
8.2.180.0150.00025.92
8.2.170.0040.01819.21
8.2.160.0090.00622.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0110.00726.16
8.2.120.0030.00521.01
8.2.110.0030.00721.04
8.2.100.0090.00318.16
8.2.90.0040.00419.30
8.2.80.0000.00817.97
8.2.70.0030.00617.88
8.2.60.0060.00318.29
8.2.50.0040.00418.10
8.2.40.0070.00718.16
8.2.30.0050.00318.10
8.2.20.0040.00417.96
8.2.10.0030.00518.27
8.2.00.0030.00517.91
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.87
8.1.230.0080.00321.05
8.1.220.0060.00317.78
8.1.210.0040.00418.77
8.1.200.0060.00317.60
8.1.190.0060.00317.48
8.1.180.0040.00418.10
8.1.170.0050.00318.84
8.1.160.0000.00721.99
8.1.150.0070.00018.84
8.1.140.0000.00717.62
8.1.130.0040.00417.88
8.1.120.0000.00717.61
8.1.110.0050.00317.61
8.1.100.0040.00417.63
8.1.90.0000.00817.65
8.1.80.0040.00417.62
8.1.70.0030.00617.47
8.1.60.0100.00017.66
8.1.50.0030.00617.55
8.1.40.0050.00317.60
8.1.30.0040.00417.55
8.1.20.0080.00017.77
8.1.10.0000.00817.71
8.1.00.0030.00517.46
8.0.300.0050.00320.13
8.0.290.0060.00316.88
8.0.280.0000.00718.54
8.0.270.0050.00317.35
8.0.260.0000.00717.35
8.0.250.0070.00017.09
8.0.240.0030.00617.18
8.0.230.0040.00417.13
8.0.220.0050.00217.00
8.0.210.0040.00417.07
8.0.200.0030.00317.00
8.0.190.0000.00817.02
8.0.180.0000.00817.09
8.0.170.0000.00817.15
8.0.160.0030.00517.03
8.0.150.0040.00416.95
8.0.140.0050.00316.86
8.0.130.0000.00613.49
8.0.120.0000.00817.04
8.0.110.0050.00316.96
8.0.100.0040.00416.97
8.0.90.0040.00416.86
8.0.80.0060.01017.11
8.0.70.0040.00417.05
8.0.60.0040.00417.09
8.0.50.0080.00016.90
8.0.30.0050.01417.09
8.0.20.0140.00917.40
8.0.10.0040.00416.98
8.0.00.0080.01016.85
7.4.330.0050.00015.20
7.4.320.0060.00016.62
7.4.300.0000.00616.51
7.4.290.0030.00516.69
7.4.280.0080.00016.71
7.4.270.0050.00316.60
7.4.260.0040.00416.61
7.4.250.0050.00316.59
7.4.240.0040.00416.72
7.4.230.0050.00216.44
7.4.220.0110.00716.59
7.4.210.0040.01116.57
7.4.200.0040.00416.75
7.4.160.0030.01316.64
7.4.150.0120.00617.40
7.4.140.0060.01317.86
7.4.130.0140.00316.67
7.4.120.0060.01516.53
7.4.110.0100.01716.78
7.4.100.0060.01616.82
7.4.90.0100.00916.69
7.4.80.0110.00819.39
7.4.70.0070.01016.59
7.4.60.0110.00616.64
7.4.50.0050.00316.59
7.4.40.0120.01216.79
7.4.30.0120.00616.87
7.4.00.0090.01014.97
7.3.330.0040.00413.56
7.3.320.0030.00313.47
7.3.310.0000.00716.53
7.3.300.0070.00016.39
7.3.290.0110.00316.57
7.3.280.0110.00816.53
7.3.270.0070.01317.40
7.3.260.0190.00316.72
7.3.250.0090.00816.63
7.3.240.0190.00416.45
7.3.230.0120.00616.54
7.3.210.0130.00416.78
7.3.200.0130.00719.39
7.3.190.0070.01716.56
7.3.180.0130.00316.81
7.3.170.0210.03316.73
7.3.160.0060.01016.59
7.3.120.0080.00815.06
7.3.110.0100.00615.18
7.3.100.0080.00815.23
7.3.90.0080.00715.01
7.3.80.0080.00915.11
7.3.70.0050.01115.05
7.3.60.0050.00915.04
7.3.50.0050.00714.91
7.3.40.0060.00815.05
7.3.30.0050.01014.98
7.3.20.0060.00916.67
7.3.10.0050.01016.69
7.3.00.0080.00616.69
7.2.330.0040.01516.89
7.2.320.0050.01316.89
7.2.310.0100.00716.72
7.2.300.0090.00916.59
7.2.290.0060.01016.57
7.2.250.0070.01015.15
7.2.240.0110.00815.24
7.2.230.0080.01015.23
7.2.220.0060.00615.06
7.2.210.0060.01015.10
7.2.200.0080.00815.09
7.2.190.0030.01014.96
7.2.180.0050.01215.21
7.2.170.0060.00815.24
7.2.160.0060.00614.87
7.2.150.0070.00716.98
7.2.140.0060.00916.79
7.2.130.0030.01317.05
7.2.120.0050.01116.91
7.2.110.0080.01016.84
7.2.100.0150.00816.82
7.2.90.0190.01116.84
7.2.80.1060.00616.86
7.2.70.0070.00917.02
7.2.60.0220.00716.90
7.2.50.0170.01017.05
7.2.40.0070.00917.12
7.2.30.0040.01116.97
7.2.20.0070.01016.86
7.2.10.0090.00816.83
7.2.00.0060.00917.57
7.1.330.0030.00815.91
7.1.320.0070.01015.61
7.1.310.0060.01015.90
7.1.300.0040.00915.96
7.1.290.0110.00315.96
7.1.280.0000.01215.87
7.1.270.0070.00415.96
7.1.260.0040.00715.85
7.1.250.0100.00415.83
7.1.240.0060.00615.88
7.1.230.0070.00715.78
7.1.220.0120.00415.88
7.1.210.0120.00315.73
7.1.200.0080.00615.79
7.1.190.0070.00615.85
7.1.180.0030.01215.68
7.1.170.0060.00715.82
7.1.160.0130.00315.99
7.1.150.0060.00915.67
7.1.140.0160.01115.71
7.1.130.0140.00915.82
7.1.120.0100.00415.80
7.1.110.0110.00715.81
7.1.100.0090.00516.55
7.1.90.0110.00515.96
7.1.80.0370.00715.56
7.1.70.0120.00316.29
7.1.60.0070.01316.95
7.1.50.0050.01616.31
7.1.40.0060.00815.96
7.1.30.0080.00515.61
7.1.20.0100.00515.85
7.1.10.0050.00815.79
7.1.00.0080.03018.03
7.0.330.0120.00315.16
7.0.320.0090.00615.30
7.0.310.0090.00515.23
7.0.300.0100.00415.56
7.0.290.0050.00915.38
7.0.280.0180.00515.37
7.0.270.0080.00715.33
7.0.260.0110.00515.27
7.0.250.0140.00915.37
7.0.240.0090.00815.41
7.0.230.0080.00615.52
7.0.220.0180.00715.53
7.0.210.0050.00715.38
7.0.200.0050.00616.00
7.0.190.0050.01315.32
7.0.180.0050.01015.43
7.0.170.0090.00715.40
7.0.160.0120.00315.40
7.0.150.0070.00815.45
7.0.140.0070.02817.61
7.0.130.0060.01015.46
7.0.120.0150.00715.24
7.0.110.0080.00615.48
7.0.100.0150.01816.94
7.0.90.0180.03116.97
7.0.80.0140.01916.94
7.0.70.0060.03416.93
7.0.60.0160.03017.01
7.0.50.0180.02717.17
7.0.40.0080.02115.71
7.0.30.0100.02915.86
7.0.20.0080.01815.73
7.0.10.0060.02015.56
7.0.00.0080.01615.77
5.6.400.0030.01314.31
5.6.390.0070.00714.78
5.6.380.0070.00614.36
5.6.370.0050.00914.71
5.6.360.0080.00514.63
5.6.350.0080.01014.57
5.6.340.0090.00414.31
5.6.330.0120.00314.74
5.6.320.0080.00614.56
5.6.310.0120.00314.66
5.6.300.0100.00514.46
5.6.290.0090.00814.58
5.6.280.0120.00514.58
5.6.270.0070.00714.66
5.6.260.0090.00414.56
5.6.250.0080.01816.73
5.6.240.0100.02916.59
5.6.230.0090.02616.53
5.6.220.0070.02016.44
5.6.210.0070.03516.51
5.6.200.0070.03816.87
5.6.190.0150.01416.75
5.6.180.0070.03216.64
5.6.170.0040.02116.83
5.6.160.0060.02016.81
5.6.150.0070.01916.84
5.6.140.0080.01716.73
5.6.130.0080.01716.71
5.6.120.0080.01616.74
5.6.110.0070.01916.82
5.6.100.0100.01616.64
5.6.90.0060.02016.71
5.6.80.0020.02216.40
5.6.70.0030.02116.29
5.6.60.0070.01716.53
5.6.50.0100.02316.33
5.6.40.0080.01816.35
5.6.30.0060.01916.50
5.6.20.0050.01716.45
5.6.10.0110.01716.43
5.6.00.0080.01916.48
5.5.380.0130.02615.96
5.5.370.0100.03015.95
5.5.360.0080.01816.08
5.5.350.0060.02915.93
5.5.340.0080.02916.00
5.5.330.0090.02816.11
5.5.320.0120.02516.01
5.5.310.0110.02515.95
5.5.300.0070.01716.15
5.5.290.0080.01416.08
5.5.280.0070.01716.01
5.5.270.0050.01716.01
5.5.260.0050.02116.09
5.5.250.0090.01315.86
5.5.240.0080.01715.80
5.5.230.0040.01715.87
5.5.220.0080.01515.81
5.5.210.0050.01615.79
5.5.200.0050.01915.83
5.5.190.0080.01715.75
5.5.180.0060.01715.90
5.5.170.0080.00614.43
5.5.160.0050.01715.81
5.5.150.0060.01815.74
5.5.140.0060.01815.81
5.5.130.0080.01515.83
5.5.120.0060.01615.90
5.5.110.0080.01715.82
5.5.100.0050.01715.76
5.5.90.0060.01915.77
5.5.80.0100.01515.84
5.5.70.0060.01915.77
5.5.60.0020.02415.69
5.5.50.0080.01615.61
5.5.40.0060.01915.69
5.5.30.0030.02115.86
5.5.20.0040.02115.74
5.5.10.0070.01915.74
5.5.00.0060.02815.83
5.4.450.0080.01614.66
5.4.440.0070.01614.67
5.4.430.0060.01614.69
5.4.420.0060.01714.67
5.4.410.0090.01214.64
5.4.400.0060.01714.55
5.4.390.0080.01514.52
5.4.380.0030.01614.46
5.4.370.0070.02014.57
5.4.360.0060.01714.46
5.4.350.0030.01714.45
5.4.340.0030.01814.53
5.4.330.0060.00412.26
5.4.320.0050.02014.54
5.4.310.0030.01814.56
5.4.300.0050.01714.55
5.4.290.0070.01514.54
5.4.280.0040.01814.54
5.4.270.0080.01714.52
5.4.260.0040.01914.55
5.4.250.0050.01714.48
5.4.240.0070.01614.52
5.4.230.0040.01614.52
5.4.220.0070.01714.59
5.4.210.0080.01314.55
5.4.200.0120.01014.52
5.4.190.0060.01614.53
5.4.180.0050.01714.48
5.4.170.0050.02914.52
5.4.160.0090.02314.51
5.4.150.0050.03214.52
5.4.140.0070.02713.66
5.4.130.0040.03113.66
5.4.120.0070.01713.63
5.4.110.0060.03113.67
5.4.100.0110.02413.63
5.4.90.0060.02613.68
5.4.80.0050.02713.69
5.4.70.0080.02613.66
5.4.60.0080.01613.62
5.4.50.0100.01813.63
5.4.40.0060.02613.69
5.4.30.0100.02313.64
5.4.20.0090.02113.66
5.4.10.0030.02013.64
5.4.00.0050.02713.50

preferences:
47.17 ms | 400 KiB | 5 Q