3v4l.org

run code in 300+ PHP versions simultaneously
<?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' => $_POST["email"], 'cus_id' => $_POST["cus_id"] ); $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"; } 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 */ //http://bit.ly/ZeSVQ5 function php_compat_hash_hmac($algo, $data, $key, $raw_output = false) { $blocksize = 64; $ipad = str_repeat("\x36", $blocksize); $opad = str_repeat("\x5c", $blocksize); if (strlen($key) > $blocksize) { $key = hash($algo, $key, true); } else { $key = str_pad($key, $blocksize, "\x00"); } $ipad ^= $key; $opad ^= $key; return hash($algo, $opad . hash($algo, $ipad . $data, true), $raw_output); } //http://bit.ly/1uH6OR0 if (!function_exists('json_encode')) { function 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[] = json_encode($v); return '[' . join(',', $result) . ']'; } else { foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v); return '{' . join(',', $result) . '}'; } } } //http://bit.ly/1q8GwII if (!function_exists('http_build_query')) { function 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.0140.00016.86
8.3.50.0130.00622.99
8.3.40.0120.00618.85
8.3.30.0060.00919.09
8.3.20.0000.00820.25
8.3.10.0000.00723.61
8.3.00.0040.00419.51
8.2.180.0060.01016.75
8.2.170.0110.00422.96
8.2.160.0110.00420.47
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00420.89
8.2.110.0030.00620.59
8.2.100.0090.00317.85
8.2.90.0120.00019.28
8.2.80.0040.00417.97
8.2.70.0000.01017.63
8.2.60.0000.00818.18
8.2.50.0000.00818.07
8.2.40.0050.00518.34
8.2.30.0000.00718.17
8.2.20.0050.00317.81
8.2.10.0040.00418.17
8.2.00.0030.00617.82
8.1.280.0040.01125.92
8.1.270.0040.00423.80
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00023.81
8.1.230.0090.00323.78
8.1.220.0000.00817.89
8.1.210.0000.00818.77
8.1.200.0060.00317.50
8.1.190.0000.00817.35
8.1.180.0030.00618.10
8.1.170.0040.00418.73
8.1.160.0000.00822.16
8.1.150.0040.00418.86
8.1.140.0040.00417.47
8.1.130.0000.00817.97
8.1.120.0000.00817.55
8.1.110.0000.00817.55
8.1.100.0070.00017.56
8.1.90.0000.00717.58
8.1.80.0050.00317.62
8.1.70.0070.00017.50
8.1.60.0000.00917.71
8.1.50.0000.00817.57
8.1.40.0040.00417.46
8.1.30.0050.00317.63
8.1.20.0030.00617.70
8.1.10.0070.00317.64
8.1.00.0000.01117.63
8.0.300.0070.00018.77
8.0.290.0060.00316.88
8.0.280.0070.00018.50
8.0.270.0050.00217.25
8.0.260.0030.00317.36
8.0.250.0070.00017.11
8.0.240.0000.00817.02
8.0.230.0040.00417.18
8.0.220.0030.00317.02
8.0.210.0050.00317.02
8.0.200.0000.00617.14
8.0.190.0090.00017.08
8.0.180.0040.00417.09
8.0.170.0000.00816.94
8.0.160.0000.00717.14
8.0.150.0040.00416.91
8.0.140.0000.00716.94
8.0.130.0000.00613.55
8.0.120.0000.00816.93
8.0.110.0040.00417.07
8.0.100.0000.00816.93
8.0.90.0030.00517.01
8.0.80.0120.01017.11
8.0.70.0050.00316.91
8.0.60.0030.00617.11
8.0.50.0040.00417.02
8.0.30.0110.01017.20
8.0.20.0100.00917.40
8.0.10.0040.00417.25
8.0.00.0110.00616.80
7.4.330.0050.00015.14
7.4.320.0030.00316.59
7.4.300.0000.00616.60
7.4.290.0030.00516.63
7.4.280.0040.00416.70
7.4.270.0030.00316.55
7.4.260.0040.00416.61
7.4.250.0040.00416.57
7.4.240.0020.00616.68
7.4.230.0000.00716.67
7.4.220.0130.00516.69
7.4.210.0090.00916.68
7.4.200.0080.00016.41
7.4.160.0130.00316.77
7.4.150.0190.00017.40
7.4.140.0100.00917.86
7.4.130.0180.00416.62
7.4.120.0120.00816.66
7.4.110.0110.00716.64
7.4.100.0130.00316.63
7.4.90.0060.01316.69
7.4.80.0030.01319.39
7.4.70.0060.01216.57
7.4.60.0090.00816.50
7.4.50.0080.00016.23
7.4.40.0090.00616.55
7.4.30.0090.00916.54
7.4.00.0080.00414.95
7.3.330.0040.00413.39
7.3.320.0030.00313.46
7.3.310.0040.00416.28
7.3.300.0030.00316.41
7.3.290.0060.01016.46
7.3.280.0120.00516.49
7.3.270.0090.00917.40
7.3.260.0140.01116.84
7.3.250.0120.00516.57
7.3.240.0080.00816.57
7.3.230.0130.01316.43
7.3.210.0040.01416.57
7.3.200.0090.00919.39
7.3.190.0190.00616.39
7.3.180.0030.01316.55
7.3.170.0060.01116.47
7.3.160.0130.00316.37
7.2.330.0110.00816.73
7.2.320.0090.01516.93
7.2.310.0050.01216.44
7.2.300.0120.00616.66
7.2.290.0030.01416.62
7.2.60.0090.00617.04
7.2.00.0040.01119.41
7.1.200.0030.00715.72
7.1.100.0030.00718.07
7.1.70.0000.00717.23
7.1.60.0030.02319.40
7.1.50.0130.01017.02
7.1.00.0030.07722.36
7.0.200.0050.00316.76
7.0.140.0030.07322.09
7.0.90.0370.08020.22
7.0.80.0400.08319.99
7.0.70.0600.08719.98
7.0.60.0630.09020.04
7.0.50.0530.05720.32
7.0.40.0070.08020.18
7.0.30.0030.08720.18
7.0.20.0100.04020.13
7.0.10.0130.07720.07
7.0.00.0070.08020.17
5.6.280.0030.07320.82
5.6.240.0130.07320.73
5.6.230.0170.07720.63
5.6.220.0170.07320.63
5.6.210.0100.06720.70
5.6.200.0030.07321.14
5.6.190.0130.07321.19
5.6.180.0070.07321.01
5.6.170.0030.09021.19
5.6.160.0030.08021.23
5.6.150.0130.07721.09
5.6.140.0030.06721.13
5.6.130.0030.08021.06
5.6.120.0070.07721.09
5.6.110.0100.04320.98
5.6.100.0030.08321.21
5.6.90.0170.06721.14
5.6.80.0170.06720.39
5.6.70.0100.07020.48
5.6.60.0100.07720.48
5.6.50.0070.08020.50
5.6.40.0130.07720.41
5.6.30.0030.05720.47
5.6.20.0130.07320.43
5.6.10.0030.09020.49
5.6.00.0100.07320.43
5.5.380.0100.08020.55
5.5.370.0070.06020.40
5.5.360.0170.07320.40
5.5.350.0170.07320.51
5.5.340.0000.05720.70
5.5.330.0100.05020.88
5.5.320.0070.08320.81
5.5.310.0030.08320.85
5.5.300.0030.05020.83
5.5.290.0070.08320.96
5.5.280.0130.07320.70
5.5.270.0000.08320.81
5.5.260.0030.08320.92
5.5.250.0070.05020.74
5.5.240.0100.07320.34
5.5.230.0070.08320.33
5.5.220.0130.04020.34
5.5.210.0170.06320.36
5.5.200.0130.06320.14
5.5.190.0100.08020.05
5.5.180.0130.07020.29
5.5.160.0070.08020.29
5.5.150.0030.07720.29
5.5.140.0070.07320.30
5.5.130.0130.05320.13
5.5.120.0100.07320.29
5.5.110.0070.07020.16
5.5.100.0100.07320.11
5.5.90.0030.07720.10
5.5.80.0100.06020.00
5.5.70.0170.07019.98
5.5.60.0070.08020.14
5.5.50.0030.05319.98
5.5.40.0100.06320.14
5.5.30.0070.05320.19
5.5.20.0070.04720.11
5.5.10.0070.08020.14
5.5.00.0070.06020.10
5.4.450.0100.07319.21
5.4.440.0100.07019.45
5.4.430.0000.04719.34
5.4.420.0130.06719.55
5.4.410.0030.06319.04
5.4.400.0030.07719.18
5.4.390.0130.06719.05
5.4.380.0130.07019.25
5.4.370.0100.07018.88
5.4.360.0130.07019.18
5.4.350.0030.07719.04
5.4.340.0130.07319.06
5.4.320.0030.07318.88
5.4.310.0030.05719.03
5.4.300.0170.06718.90
5.4.290.0030.06019.12
5.4.280.0070.05719.18
5.4.270.0130.06319.23
5.4.260.0070.07018.91
5.4.250.0070.07719.22
5.4.240.0030.07719.20
5.4.230.0070.07018.95
5.4.220.0030.05319.03
5.4.210.0100.07719.04
5.4.200.0100.06019.18
5.4.190.0000.04319.06
5.4.180.0000.05319.11
5.4.170.0030.08019.24
5.4.160.0100.06719.19
5.4.150.0130.07019.01
5.4.140.0070.05016.44
5.4.130.0170.06316.25
5.4.120.0070.06716.41
5.4.110.0070.07316.56
5.4.100.0100.07016.49
5.4.90.0030.05716.54
5.4.80.0100.07316.39
5.4.70.0030.05316.31
5.4.60.0000.04316.52
5.4.50.0070.06016.53
5.4.40.0100.05316.53
5.4.30.0170.06316.53
5.4.20.0070.06716.41
5.4.10.0100.06316.38
5.4.00.0030.04315.79

preferences:
46.7 ms | 401 KiB | 5 Q