3v4l.org

run code in 300+ PHP versions simultaneously
<?php //require_once (dirname(__FILE__) . "/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://'; $email = ''; $cus_id = ''; /*if ($argc >= 3) { $email = $argv[2]; $cus_id = $argv[3]; }*/ $message = array( 'topic' => 'updateCusNumberRequest', 'email' => $email, 'cus_id' => $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); /* php4 compatible functions */ //http://bit.ly/1qd0Usl 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); } //http://bit.ly/1nIYD2h 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.0090.00617.00
8.3.50.0120.00522.91
8.3.40.0090.00619.10
8.3.30.0150.00319.26
8.3.20.0030.00620.39
8.3.10.0080.00023.66
8.3.00.0090.00019.50
8.2.180.0060.01118.50
8.2.170.0150.00022.96
8.2.160.0120.00318.91
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0090.00020.52
8.2.110.0070.00320.29
8.2.100.0120.00019.58
8.2.90.0030.00518.47
8.2.80.0030.00517.97
8.2.70.0050.00317.50
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0100.00018.28
8.2.30.0000.00818.26
8.2.20.0040.00417.89
8.2.10.0040.00418.13
8.2.00.0040.00417.70
8.1.280.0120.00325.92
8.1.270.0140.00723.83
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0100.00022.32
8.1.230.0040.00820.92
8.1.220.0040.00417.89
8.1.210.0080.00018.84
8.1.200.0130.00017.60
8.1.190.0080.00017.36
8.1.180.0030.00518.10
8.1.170.0040.00418.74
8.1.160.0040.00422.06
8.1.150.0000.00718.91
8.1.140.0000.00717.59
8.1.130.0030.00317.78
8.1.120.0000.00817.55
8.1.110.0040.00417.51
8.1.100.0050.00317.61
8.1.90.0040.00417.63
8.1.80.0040.00417.50
8.1.70.0080.00017.43
8.1.60.0040.00417.60
8.1.50.0030.00517.62
8.1.40.0040.00417.57
8.1.30.0040.00417.71
8.1.20.0000.00817.73
8.1.10.0030.00517.64
8.1.00.0040.00817.52
8.0.300.0000.00720.21
8.0.290.0080.00017.00
8.0.280.0070.00018.44
8.0.270.0000.00717.25
8.0.260.0030.00317.30
8.0.250.0070.00017.18
8.0.240.0040.00417.03
8.0.230.0000.00717.09
8.0.220.0030.00417.00
8.0.210.0040.00417.08
8.0.200.0000.00617.14
8.0.190.0040.00417.06
8.0.180.0040.00717.04
8.0.170.0040.00417.05
8.0.160.0000.00817.08
8.0.150.0050.00216.86
8.0.140.0040.00416.90
8.0.130.0000.00613.43
8.0.120.0030.00516.89
8.0.110.0080.00017.03
8.0.100.0040.00416.98
8.0.90.0050.00316.91
8.0.80.0060.00917.01
8.0.70.0000.00716.95
8.0.60.0000.00817.09
8.0.50.0000.00816.82
8.0.30.0090.01217.27
8.0.20.0110.01417.40
8.0.10.0040.00417.05
8.0.00.0090.01016.82
7.4.330.0000.00515.09
7.4.320.0060.00016.49
7.4.300.0030.00316.54
7.4.290.0040.00416.55
7.4.280.0080.00016.70
7.4.270.0000.00716.58
7.4.260.0030.00316.59
7.4.250.0080.00016.53
7.4.240.0000.00816.68
7.4.230.0000.00716.69
7.4.220.0070.01116.61
7.4.210.0070.01316.65
7.4.200.0050.00216.69
7.4.160.0090.00916.72
7.4.150.0130.00917.40
7.4.140.0170.00317.86
7.4.130.0120.00916.70
7.4.120.0120.00516.79
7.4.110.0040.01516.60
7.4.100.0070.01016.66
7.4.90.0070.01016.76
7.4.80.0150.00319.39
7.4.70.0110.00716.43
7.4.60.0090.00916.57
7.4.50.0000.00816.35
7.4.40.0120.00616.71
7.4.30.0140.00716.71
7.4.10.0110.00714.88
7.4.00.0050.01015.11
7.3.330.0030.00613.28
7.3.320.0000.00513.45
7.3.310.0000.00816.47
7.3.300.0000.00716.51
7.3.290.0080.01216.54
7.3.280.0090.00716.51
7.3.270.0060.01217.40
7.3.260.0140.01416.64
7.3.250.0120.00516.62
7.3.240.0110.01116.55
7.3.230.0070.01016.57
7.3.210.0100.00716.63
7.3.200.0160.00619.39
7.3.190.0030.01316.51
7.3.180.0070.01016.67
7.3.170.0030.01916.58
7.3.160.0060.01016.52
7.3.130.0070.01015.18
7.3.120.0050.00914.95
7.3.110.0090.00914.80
7.3.100.0070.01114.90
7.3.90.0080.00514.74
7.3.80.0030.01014.89
7.3.70.0080.00814.91
7.3.60.0070.00714.86
7.3.50.0070.01014.98
7.3.40.0120.00414.84
7.3.30.0070.00714.91
7.3.20.0060.00616.67
7.3.10.0120.00416.51
7.3.00.0100.00916.59
7.2.330.0090.01016.55
7.2.320.0070.01116.96
7.2.310.0100.00716.61
7.2.300.0110.00716.87
7.2.290.0090.01316.90
7.2.260.0000.01615.30
7.2.250.0090.01014.95
7.2.240.0080.00815.31
7.2.230.0050.00815.23
7.2.220.0080.00715.16
7.2.210.0060.00715.11
7.2.200.0090.00715.37
7.2.190.0070.00515.14
7.2.180.0060.00915.14
7.2.170.0080.00815.08
7.2.160.0040.01114.89
7.2.150.0060.00616.67
7.2.140.0110.00316.92
7.2.130.0100.00616.69
7.2.120.0080.00816.88
7.2.110.0100.00916.73
7.2.100.0130.01316.67
7.2.90.0110.01216.29
7.2.80.0120.01016.76
7.2.70.0100.01116.80
7.2.60.0120.01316.60
7.2.50.0110.00916.46
7.2.40.0090.01216.54
7.2.30.0100.00816.61
7.2.20.0070.01116.53
7.2.10.0090.00816.61
7.2.00.0090.00717.70
7.1.330.0080.00815.82
7.1.320.0100.00315.83
7.1.310.0040.00915.90
7.1.300.0060.00615.63
7.1.290.0040.00815.91
7.1.280.0100.00315.82
7.1.270.0040.00915.78
7.1.260.0060.00715.76
7.1.250.0110.00915.64
7.1.240.0140.00315.78
7.1.230.0100.00515.80
7.1.220.0090.00915.73
7.1.210.0080.00815.30
7.1.200.0090.00615.61
7.1.190.0060.00615.48
7.1.180.0060.01015.76
7.1.170.0000.00915.53
7.1.160.0060.01015.80
7.1.150.0070.00715.42
7.1.140.0040.00415.81
7.1.130.0000.01715.65
7.1.120.0030.00915.45
7.1.110.0060.00315.64
7.1.100.0050.00916.97
7.1.90.0060.01015.72
7.1.80.0070.00415.56
7.1.70.0030.01216.49
7.1.60.0100.01017.49
7.1.50.0050.01416.37
7.1.40.0060.00915.61
7.1.30.0100.00315.96
7.1.20.0060.00615.52
7.1.10.0040.01215.88
7.1.00.0080.04019.05
7.0.330.0030.01015.41
7.0.320.0130.00715.38
7.0.310.0090.00615.61
7.0.300.0100.00715.16
7.0.290.0030.01315.07
7.0.280.0070.00315.14
7.0.270.0060.00615.25
7.0.260.0030.01415.12
7.0.250.0090.00315.33
7.0.240.0000.01415.41
7.0.230.0000.00915.18
7.0.220.0080.00415.45
7.0.210.0000.01415.56
7.0.200.0030.00715.96
7.0.190.0060.00915.29
7.0.180.0040.00815.37
7.0.170.0030.01115.41
7.0.160.0160.00315.34
7.0.150.0030.01315.13
7.0.140.0060.03918.80
7.0.130.0120.00315.57
7.0.120.0040.00815.56
7.0.110.0030.01315.54
7.0.100.0140.04117.64
7.0.90.0160.04317.73
7.0.80.0230.04817.72
7.0.70.0070.04317.69
7.0.60.0200.04217.74
7.0.50.0040.02718.02
7.0.40.0000.05316.62
7.0.30.0030.04316.76
7.0.20.0070.04516.79
7.0.10.0060.04516.74
7.0.00.0090.04716.83
5.6.400.0090.00014.85
5.6.390.0040.01314.68
5.6.380.0030.01014.77
5.6.370.0040.00814.29
5.6.360.0090.00614.54
5.6.350.0030.01014.55
5.6.340.0030.00914.51
5.6.330.0100.00714.81
5.6.320.0100.00714.75
5.6.310.0000.01414.27
5.6.300.0000.01514.38
5.6.290.0080.00514.39
5.6.280.0080.03517.80
5.6.270.0030.01014.43
5.6.260.0030.01314.43
5.6.250.0050.03917.61
5.6.240.0060.03017.67
5.6.230.0100.04017.40
5.6.220.0070.04717.62
5.6.210.0070.04717.57
5.6.200.0090.04517.80
5.6.190.0020.05117.62
5.6.180.0050.04317.66
5.6.170.0100.04017.58
5.6.160.0080.04617.73
5.6.150.0020.04817.70
5.6.140.0070.03517.72
5.6.130.0070.04317.67
5.6.120.0070.02917.70
5.6.110.0110.04017.80
5.6.100.0070.04617.79
5.6.90.0070.04217.75
5.6.80.0020.04617.49
5.6.70.0110.02217.30
5.6.60.0030.04517.19
5.6.50.0070.04317.54
5.6.40.0090.04117.46
5.6.30.0070.03517.30
5.6.20.0070.02717.27
5.6.10.0170.03517.63
5.6.00.0080.04017.27
5.5.380.0070.02517.41
5.5.370.0030.05017.34
5.5.360.0070.04517.47
5.5.350.0050.05017.55
5.5.340.0050.04317.72
5.5.330.0100.04017.61
5.5.320.0000.05017.66
5.5.310.0130.03517.73
5.5.300.0110.02517.54
5.5.290.0050.04617.64
5.5.280.0080.04417.65
5.5.270.0050.04617.67
5.5.260.0120.03817.51
5.5.250.0080.04517.67
5.5.240.0030.05217.33
5.5.230.0060.04517.42
5.5.220.0070.03917.30
5.5.210.0080.04117.34
5.5.200.0110.04017.37
5.5.190.0050.03517.36
5.5.180.0070.02517.44
5.5.170.0030.01314.34
5.5.160.0080.02817.15
5.5.150.0070.04217.14
5.5.140.0050.03517.44
5.5.130.0000.05217.36
5.5.120.0060.04117.26
5.5.110.0020.04817.19
5.5.100.0100.04017.39
5.5.90.0040.04117.26
5.5.80.0110.04017.33
5.5.70.0120.04017.38
5.5.60.0080.04817.32
5.5.50.0150.02517.41
5.5.40.0080.04017.21
5.5.30.0070.02717.36
5.5.20.0040.02717.37
5.5.10.0050.02517.39
5.5.00.0030.02517.01
5.4.450.0100.03515.21
5.4.440.0030.04515.23
5.4.430.0030.04715.40
5.4.420.0100.03715.21
5.4.410.0080.04215.21
5.4.400.0050.04215.29
5.4.390.0050.04615.20
5.4.380.0050.02414.90
5.4.370.0080.02415.30
5.4.360.0050.04015.22
5.4.350.0090.03815.17
5.4.340.0050.02715.12
5.4.330.0000.00711.23
5.4.320.0050.04015.35
5.4.310.0100.03614.96
5.4.300.0030.02915.11
5.4.290.0020.03515.14
5.4.280.0030.04515.24
5.4.270.0090.01815.25
5.4.260.0050.04015.05
5.4.250.0090.03515.16
5.4.240.0050.04215.22
5.4.230.0030.02515.16
5.4.220.0080.02215.04
5.4.210.0060.04215.18
5.4.200.0030.02015.18
5.4.190.0030.02515.08
5.4.180.0060.02415.23
5.4.170.0020.02415.09
5.4.160.0020.02615.29
5.4.150.0070.02115.21
5.4.140.0080.01813.97
5.4.130.0050.02113.76
5.4.120.0050.02313.76
5.4.110.0060.01813.79
5.4.100.0050.01713.93
5.4.90.0020.02013.70
5.4.80.0090.01713.98
5.4.70.0030.02413.91
5.4.60.0030.02113.99
5.4.50.0050.02013.87
5.4.40.0050.02513.93
5.4.30.0050.03213.79
5.4.20.0030.02313.86
5.4.10.0060.02013.79
5.4.00.0080.03113.63

preferences:
49.75 ms | 401 KiB | 5 Q