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); /* 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.40.0180.00418.95
8.3.30.0060.00919.17
8.3.20.0040.00420.25
8.3.10.0000.00823.55
8.3.00.0060.00319.50
8.2.170.0110.00322.96
8.2.160.0050.00820.51
8.2.150.0030.00524.18
8.2.140.0090.00024.66
8.2.130.0070.01026.16
8.2.120.0050.00321.03
8.2.110.0110.00021.18
8.2.100.0040.00818.16
8.2.90.0060.00619.46
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0000.00817.80
8.2.50.0000.00818.07
8.2.40.0040.00718.09
8.2.30.0000.00818.20
8.2.20.0050.00317.82
8.2.10.0000.00718.07
8.2.00.0000.00717.79
8.1.270.0080.01223.70
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0060.00319.48
8.1.230.0040.00821.01
8.1.220.0050.00317.79
8.1.210.0080.00018.77
8.1.200.0090.00017.48
8.1.190.0030.00517.47
8.1.180.0000.00818.10
8.1.170.0060.00318.73
8.1.160.0040.00422.04
8.1.150.0080.00018.84
8.1.140.0070.00017.59
8.1.130.0030.00317.95
8.1.120.0000.00817.52
8.1.110.0000.00717.61
8.1.100.0000.00717.59
8.1.90.0000.00817.63
8.1.80.0040.00417.55
8.1.70.0000.00717.48
8.1.60.0070.00317.68
8.1.50.0060.00317.57
8.1.40.0030.00517.53
8.1.30.0000.00817.57
8.1.20.0040.00417.72
8.1.10.0000.00817.64
8.1.00.0040.00417.55
8.0.300.0000.00818.77
8.0.290.0080.00017.00
8.0.280.0040.00418.52
8.0.270.0030.00317.25
8.0.260.0000.00717.27
8.0.250.0070.00017.14
8.0.240.0040.00417.06
8.0.230.0030.00517.00
8.0.220.0050.00217.11
8.0.210.0040.00416.96
8.0.200.0030.00317.01
8.0.190.0000.00817.02
8.0.180.0000.00816.98
8.0.170.0000.00817.14
8.0.160.0040.00416.93
8.0.150.0020.00517.01
8.0.140.0060.00316.93
8.0.130.0000.00713.45
8.0.120.0030.00516.96
8.0.110.0000.00817.07
8.0.100.0040.00416.96
8.0.90.0030.00517.01
8.0.80.0090.00617.01
8.0.70.0040.00416.92
8.0.60.0080.00017.05
8.0.50.0040.00417.09
8.0.30.0120.00917.35
8.0.20.0130.00817.45
8.0.10.0040.00417.14
8.0.00.0110.00716.84
7.4.330.0000.00515.00
7.4.320.0000.00616.69
7.4.300.0000.00616.64
7.4.290.0030.00516.72
7.4.280.0040.00416.56
7.4.270.0000.00716.58
7.4.260.0000.00716.57
7.4.250.0050.00316.52
7.4.240.0060.00116.60
7.4.230.0000.00816.66
7.4.220.0110.00616.64
7.4.210.0060.01016.79
7.4.200.0040.00416.71
7.4.160.0130.00316.70
7.4.150.0070.01117.40
7.4.140.0100.00817.86
7.4.130.0080.00816.63
7.4.120.0090.00916.72
7.4.110.0070.01016.70
7.4.100.0100.00716.73
7.4.90.0100.00716.52
7.4.80.0140.00919.39
7.4.70.0070.01016.67
7.4.60.0090.00916.74
7.4.50.0000.00816.55
7.4.40.0100.00716.85
7.4.30.0080.00816.54
7.4.00.0000.01515.02
7.3.330.0060.00013.57
7.3.320.0000.00513.46
7.3.310.0070.00016.36
7.3.300.0040.00416.40
7.3.290.0070.00716.53
7.3.280.0100.00816.49
7.3.270.0040.01717.40
7.3.260.0200.00416.69
7.3.250.0110.00616.58
7.3.240.0100.01016.61
7.3.230.0030.01416.51
7.3.210.0100.00716.57
7.3.200.0040.01216.42
7.3.190.0070.01116.62
7.3.180.0100.00616.45
7.3.170.0110.00716.58
7.3.160.0120.00416.46
7.2.330.0110.00716.86
7.2.320.0150.00316.71
7.2.310.0140.00316.73
7.2.300.0070.01016.73
7.2.290.0100.00717.00
7.2.60.0070.01017.11
7.2.00.0070.00319.41
7.1.200.0040.00715.79
7.1.100.0030.00918.16
7.1.70.0000.00817.28
7.1.60.0040.01819.40
7.1.50.0100.01617.12
7.1.00.0000.07722.45
7.0.200.0000.00716.86
7.0.140.0030.07322.18
7.0.60.0100.04719.98
7.0.50.0000.08317.85
7.0.40.0030.04320.40
7.0.30.0600.07720.07
7.0.20.0270.07720.09
7.0.10.0070.04020.09
7.0.00.0130.05020.19
5.6.280.0100.07021.09
5.6.210.0100.08020.59
5.6.200.0030.08018.29
5.6.190.0130.08020.51
5.6.180.0400.07720.46
5.6.170.0270.05020.62
5.6.160.0070.03720.57
5.6.150.0130.07318.27
5.6.140.0030.04018.26
5.6.130.0170.07318.30
5.6.120.0070.04320.97
5.6.110.0070.09021.10
5.6.100.0130.07721.02
5.6.90.0100.08321.02
5.6.80.0070.07320.43
5.5.350.0300.06720.36
5.5.340.0100.03318.02
5.5.330.0100.08320.27
5.5.320.0300.04020.24
5.5.310.0330.05320.34
5.5.300.0070.07718.11
5.5.290.0030.05317.96
5.5.280.0170.07320.82
5.5.270.0170.07720.78
5.5.260.0130.07720.80
5.5.250.0030.08320.61
5.5.240.0130.08320.28
5.4.450.0430.04319.20
5.4.440.0270.04719.43
5.4.430.0370.03719.27
5.4.420.0300.04719.54
5.4.410.0070.06319.42
5.4.400.0200.04319.07
5.4.390.0270.02719.23
5.4.380.0270.06018.82
5.4.370.0470.07318.76
5.4.360.0470.05018.61
5.4.350.0270.05718.77
5.4.340.0400.06718.77
5.4.320.0040.03812.58
5.4.310.0080.03612.58
5.4.300.0030.04212.58
5.4.290.0060.04912.57
5.4.280.0050.04012.47
5.4.270.0050.04112.47
5.4.260.0050.03912.47
5.4.250.0090.03512.47
5.4.240.0100.04012.47
5.4.230.0120.04812.47
5.4.220.0060.05112.47
5.4.210.0080.03512.47
5.4.200.0070.03712.46
5.4.190.0110.04412.46
5.4.180.0100.03312.46
5.4.170.0070.04412.47
5.4.160.0050.05312.46
5.4.150.0060.03812.46
5.4.140.0050.04012.14
5.4.130.0090.03312.13
5.4.120.0090.03412.09
5.4.110.0090.04112.09
5.4.100.0060.03812.09
5.4.90.0070.05112.09
5.4.80.0130.04912.09
5.4.70.0060.05412.08
5.4.60.0090.05112.09
5.4.50.0070.04112.08
5.4.40.0020.04112.07
5.4.30.0090.04712.07
5.4.20.0070.03812.07
5.4.10.0040.03712.06
5.4.00.0070.04411.55
5.3.290.0030.04412.81
5.3.280.0090.03812.74
5.3.270.0110.03612.76
5.3.260.0080.04512.75
5.3.250.0120.04912.75
5.3.240.0060.05312.75
5.3.230.0070.03912.73
5.3.220.0050.03912.71
5.3.210.0060.03912.71
5.3.200.0050.03712.70
5.3.190.0090.03812.71
5.3.180.0060.03712.70
5.3.170.0040.04612.70
5.3.160.0050.03812.71
5.3.150.0100.03612.71
5.3.140.0050.04212.70
5.3.130.0050.04212.69
5.3.120.0040.04212.69
5.3.110.0100.03612.68
5.3.100.0060.03712.18
5.3.90.0060.03712.16
5.3.80.0050.03812.15
5.3.70.0090.03412.15
5.3.60.0040.04012.13
5.3.50.0070.03612.09
5.3.40.0070.03712.08
5.3.30.0040.03912.05
5.3.20.0060.03711.83
5.3.10.0060.03611.79
5.3.00.0110.03211.78
5.2.170.0040.0329.29
5.2.160.0070.0349.29
5.2.150.0050.0319.29
5.2.140.0040.0329.28
5.2.130.0030.0319.25
5.2.120.0040.0299.24
5.2.110.0050.0289.25
5.2.100.0060.0279.24
5.2.90.0030.0319.25
5.2.80.0050.0309.24
5.2.70.0020.0339.24
5.2.60.0030.0319.20
5.2.50.0100.0299.16
5.2.40.0040.0299.14
5.2.30.0050.0299.12
5.2.20.0090.0299.10
5.2.10.0060.0379.01
5.2.00.0040.0298.87
5.1.60.0040.0288.16
5.1.50.0040.0388.15
5.1.40.0030.0378.13
5.1.30.0030.0348.48
5.1.20.0050.0268.50
5.1.10.0040.0268.22
5.1.00.0040.0298.22
5.0.50.0040.0216.74
5.0.40.0050.0196.59
5.0.30.0020.0336.41
5.0.20.0060.0196.38
5.0.10.0010.0236.36
5.0.00.0050.0326.35
4.4.90.0040.0164.78
4.4.80.0040.0154.75
4.4.70.0050.0144.76
4.4.60.0020.0174.75
4.4.50.0020.0174.77
4.4.40.0060.0234.75
4.4.30.0020.0164.75
4.4.20.0020.0174.84
4.4.10.0040.0164.84
4.4.00.0030.0264.78
4.3.110.0020.0174.68
4.3.100.0030.0154.67
4.3.90.0020.0194.65
4.3.80.0040.0284.64
4.3.70.0030.0174.64
4.3.60.0040.0164.64
4.3.50.0010.0194.64
4.3.40.0020.0284.60
4.3.30.0020.0163.41
4.3.20.0030.0223.40
4.3.10.0030.0163.35
4.3.00.0030.01715.66

preferences:
46.13 ms | 400 KiB | 5 Q