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); var_dump($request); /* 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.4.20.0070.01317.81
8.4.10.0070.00317.87
8.3.140.0120.00817.00
8.3.130.0100.00016.96
8.3.120.0040.01519.07
8.3.110.0060.00320.94
8.3.100.0000.00818.40
8.3.90.0120.00418.56
8.3.80.0060.00616.75
8.3.70.0110.01116.75
8.3.60.0110.00716.50
8.3.50.0250.00822.85
8.3.40.0040.01118.92
8.3.30.0000.01419.21
8.3.20.0050.00320.16
8.3.10.0080.00623.56
8.3.00.0060.00319.50
8.2.260.0120.00316.73
8.2.250.0070.00716.86
8.2.240.0080.00017.18
8.2.230.0080.00322.58
8.2.220.0050.00537.54
8.2.210.0050.00326.77
8.2.200.0040.00416.75
8.2.190.0100.01016.63
8.2.180.0070.01518.41
8.2.170.0140.00722.96
8.2.160.0000.01420.47
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00020.95
8.2.110.0030.00622.30
8.2.100.0090.00317.97
8.2.90.0060.00317.88
8.2.80.0030.00619.04
8.2.70.0040.00417.75
8.2.60.0060.00318.15
8.2.50.0060.00318.07
8.2.40.0030.00518.22
8.2.30.0030.00618.07
8.2.20.0030.00617.89
8.2.10.0040.00418.21
8.2.00.0050.00317.71
8.1.310.0040.00716.82
8.1.300.0080.00020.22
8.1.290.0060.00318.88
8.1.280.0140.00725.92
8.1.270.0040.00423.61
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0110.00720.78
8.1.230.0040.00817.95
8.1.220.0000.00818.03
8.1.210.0050.00318.77
8.1.200.0060.00317.47
8.1.190.0070.00317.47
8.1.180.0040.00718.10
8.1.170.0100.00018.70
8.1.160.0050.00319.04
8.1.150.0050.00318.98
8.1.140.0070.00017.50
8.1.130.0070.00017.91
8.1.120.0000.00717.55
8.1.110.0070.00017.60
8.1.100.0040.00817.53
8.1.90.0040.00417.63
8.1.80.0000.00717.66
8.1.70.0050.00317.59
8.1.60.0060.00317.58
8.1.50.0050.00317.61
8.1.40.0080.00017.54
8.1.30.0050.00317.60
8.1.20.0040.00417.71
8.1.10.0040.00417.66
8.1.00.0040.00717.61
8.0.300.0040.00418.77
8.0.290.0060.00316.59
8.0.280.0080.00018.40
8.0.270.0070.00017.34
8.0.260.0000.00717.28
8.0.250.0000.00717.14
8.0.240.0050.00217.13
8.0.230.0000.00717.03
8.0.220.0030.00317.11
8.0.210.0040.00417.11
8.0.200.0000.00717.02
8.0.190.0000.00817.00
8.0.180.0030.00716.96
8.0.170.0030.00617.04
8.0.160.0040.00417.04
8.0.150.0040.00417.04
8.0.140.0020.00516.91
8.0.130.0030.00613.48
8.0.120.0030.00516.99
8.0.110.0040.00417.06
8.0.100.0050.00216.89
8.0.90.0000.00716.84
8.0.80.0060.00916.96
8.0.70.0030.00517.02
8.0.60.0040.00417.11
8.0.50.0040.00417.15
8.0.30.0180.00417.22
8.0.20.0160.00617.40
8.0.10.0050.00317.16
8.0.00.0070.01316.92
7.4.330.0000.00515.15
7.4.320.0030.00316.60
7.4.300.0030.00316.73
7.4.290.0000.00716.74
7.4.280.0000.00716.50
7.4.270.0030.00516.50
7.4.260.0000.00716.57
7.4.250.0000.00816.57
7.4.240.0050.00316.63
7.4.230.0000.00716.43
7.4.220.0150.00416.75
7.4.210.0030.01816.55
7.4.200.0000.00716.69
7.4.160.0130.00316.45
7.4.150.0130.00917.40
7.4.140.0100.00917.86
7.4.130.0100.01116.64
7.4.120.0090.00816.57
7.4.110.0130.00316.62
7.4.100.0150.00316.57
7.4.90.0030.01516.57
7.4.80.0090.00919.39
7.4.70.0120.00616.66
7.4.60.0030.01416.67
7.4.50.0050.00016.63
7.4.40.0030.01516.53
7.4.30.0070.01016.57
7.4.00.0030.01315.02
7.3.330.0080.00013.51
7.3.320.0000.00613.31
7.3.310.0030.00316.37
7.3.300.0030.00316.44
7.3.290.0090.00616.51
7.3.280.0070.01116.56
7.3.270.0160.00917.40
7.3.260.0130.01316.52
7.3.250.0090.00816.48
7.3.240.0150.00616.67
7.3.230.0030.01516.45
7.3.210.0090.00916.65
7.3.200.0110.00619.39
7.3.190.0000.01616.78
7.3.180.0090.00616.50
7.3.170.0130.00316.61
7.3.160.0080.00816.65
7.2.330.0090.00916.91
7.2.320.0100.00716.96
7.2.310.0090.00916.65
7.2.300.0060.01216.58
7.2.290.0070.01616.89
7.1.70.0040.00417.22
7.1.60.0100.00619.40
7.1.50.0260.01134.88
7.1.00.0070.07322.48
7.0.200.0000.01216.54
7.0.140.0070.07022.21
7.0.100.0100.07320.12
7.0.90.0000.05320.22
7.0.80.0000.04719.96
7.0.70.0030.03720.11
7.0.60.0130.03720.03
7.0.50.0070.07320.40
7.0.40.0100.05320.10
7.0.30.0070.03320.15
7.0.20.0070.04020.14
7.0.10.0070.04020.10
7.0.00.0030.04020.03
5.6.280.0100.06321.19
5.6.250.0100.03720.67
5.6.240.0030.04320.59
5.6.230.0100.03320.64
5.6.220.0000.03720.54
5.6.210.0070.03320.52
5.6.200.0070.04321.09
5.6.190.0100.04021.05
5.6.180.0030.05021.22
5.6.170.0130.03721.11
5.6.160.0070.04321.11
5.6.150.0030.04021.15
5.6.140.0000.04021.06
5.6.130.0070.04021.11
5.6.120.0000.04021.14
5.6.110.0030.05021.07
5.6.100.0070.03721.13
5.6.90.0070.03020.96
5.6.80.0030.03320.46
5.6.70.0130.03020.37
5.6.60.0030.03320.38
5.6.50.0070.04020.45
5.6.40.0070.03020.43
5.6.30.0100.03020.43
5.6.20.0100.03020.44
5.6.10.0000.04020.42
5.6.00.0070.03720.47
5.5.380.0030.04020.41
5.5.370.0030.04320.56
5.5.360.0100.03720.48
5.5.350.0070.03720.43
5.5.340.0070.03320.81
5.5.330.0270.06020.93
5.5.320.0030.04320.92
5.5.310.0070.05720.78
5.5.300.0030.04720.90
5.5.290.0030.04320.77
5.5.280.0130.02720.96
5.5.270.0030.04020.96
5.5.260.0000.04320.79
5.5.250.0000.03720.50
5.5.240.0030.03320.32
5.5.230.0000.03720.30
5.5.220.0070.03720.29
5.5.210.0100.02720.31
5.5.200.0070.03020.26
5.5.190.0100.02720.21
5.5.180.0070.04320.15
5.5.160.0030.04720.23
5.5.150.0100.04320.31
5.5.140.0070.06020.21
5.5.130.0070.07720.15
5.5.120.0170.02720.30
5.5.110.0070.07020.23
5.5.100.0030.06020.09
5.5.90.0030.06020.13
5.5.80.0030.07720.16
5.5.70.0100.05020.00
5.5.60.0170.06720.10
5.5.50.0100.07720.13
5.5.40.0030.04020.00
5.5.30.0000.08020.10
5.5.20.0030.03720.19
5.5.10.0100.08020.09
5.5.00.0100.07020.07
5.4.450.0070.03019.37
5.4.440.0030.03319.20
5.4.430.0070.03019.23
5.4.420.0030.03319.27
5.4.410.0030.03319.35
5.4.400.0000.03718.91
5.4.390.0100.02719.00
5.4.380.0000.05719.21
5.4.370.0030.03319.16
5.4.360.0100.03319.09
5.4.350.0000.03319.05
5.4.340.0000.04319.20
5.4.320.0070.06719.05
5.4.310.0030.04319.25
5.4.300.0100.05318.94
5.4.290.0030.07319.11
5.4.280.0000.04319.15
5.4.270.0030.08319.04
5.4.260.0100.06019.21
5.4.250.0070.07719.13
5.4.240.0100.05719.02
5.4.230.0030.07019.09
5.4.220.0030.04319.20
5.4.210.0000.08319.13
5.4.200.0070.06019.23
5.4.190.0130.07319.13
5.4.180.0100.06019.12
5.4.170.0000.05319.02
5.4.160.0070.05019.01
5.4.150.0000.05318.86
5.4.140.0070.05316.50
5.4.130.0070.02716.49
5.4.120.0070.03016.50
5.4.110.0030.03716.45
5.4.100.0030.03716.41
5.4.90.0030.07016.45
5.4.80.0000.07716.48
5.4.70.0030.03016.50
5.4.60.0030.06016.30
5.4.50.0070.07016.53
5.4.40.0200.04716.46
5.4.30.0070.03716.49
5.4.20.0070.03716.41
5.4.10.0070.07316.38
5.4.00.0070.07315.84

preferences:
19.04 ms | 403 KiB | 5 Q