3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * TME API - code snippet. * * More info at: https://developers.tme.eu */ if(!function_exists('hash_hmac')) { function hash_hmac($algo, $data, $key, $raw_output = false) { $algo = strtolower($algo); $pack = 'H'.strlen($algo('test')); $size = 64; $opad = str_repeat(chr(0x5C), $size); $ipad = str_repeat(chr(0x36), $size); if (strlen($key) > $size) { $key = str_pad(pack($pack, $algo($key)), $size, chr(0x00)); } else { $key = str_pad($key, $size, chr(0x00)); } for ($i = 0; $i < strlen($key) - 1; $i++) { $opad[$i] = $opad[$i] ^ $key[$i]; $ipad[$i] = $ipad[$i] ^ $key[$i]; } $output = $algo($opad.pack($pack, $algo($ipad.$data))); return ($raw_output) ? pack($pack, $output) : $output; } } ini_set('display_errors', 1); error_reporting(E_ALL); $token = 'b050bd709a43eecc443820c022b6774ca703ddb216b6f6765f';//'<put_your_token_here>'; $app_secret = '5656847466f0e5d08577';//<put_your_app_secret_here>'; $params = array( 'SymbolList' => array('1N4007'), 'Country' => 'PL', 'Currency' => 'PLN', 'Language' => 'PL', ); $response = api_call('Products/GetPrices', $params, $token, $app_secret, true); $result = json_decode($response, true); var_dump(PHP_VERSION); echo '<pre>'; print_r($result); echo '</pre>'; //--------------------------------------------------------- function api_call($action, $params, $token, $app_secret, $show_header=false) { $api_url = 'https://api.tme.eu/' . $action . '.json'; // calculate HMAC-SHA1 signature $params['Token'] = $token; ksort($params); // In PHP 5.4 http_build_query() offers enc_type parameter (PHP_QUERY_RFC3986) which replaces bellow snippet. $encoded_params = str_replace( array('+', '%7E'), array('%20', '~'), http_build_query($params) ); $signature_base = 'POST' . '&' . rawurlencode($api_url) . '&' . rawurlencode($encoded_params); $api_signature = base64_encode(hash_hmac('sha1', $signature_base, $app_secret, true)); $params['ApiSignature'] = $api_signature; $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($params) ) ); return file_get_contents($api_url, false, stream_context_create($opts)); }

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.70.0110.01116.88
8.3.60.0100.01318.60
8.3.50.0100.01021.08
8.3.40.0110.00418.97
8.3.30.0110.00719.21
8.3.20.0040.00420.34
8.3.10.0050.00322.12
8.3.00.0000.00822.40
8.2.190.0090.01216.63
8.2.180.0070.01116.75
8.2.170.0100.01022.96
8.2.160.0040.01519.25
8.2.150.0060.00324.18
8.2.140.0030.00524.66
8.2.130.0140.00426.16
8.2.120.0060.00319.36
8.2.110.0030.00722.29
8.2.100.0000.01118.09
8.2.90.0000.00819.22
8.2.80.0040.00418.03
8.2.70.0040.00417.63
8.2.60.0080.00017.80
8.2.50.0000.00818.07
8.2.40.0030.00519.95
8.2.30.0040.00418.13
8.2.20.0000.00717.87
8.2.10.0040.00417.81
8.2.00.0030.00517.74
8.1.280.0160.00625.92
8.1.270.0130.00721.95
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00023.83
8.1.230.0030.00919.10
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0070.00317.23
8.1.190.0090.00017.51
8.1.180.0000.00818.75
8.1.170.0030.00618.58
8.1.160.0040.00422.23
8.1.150.0040.00418.73
8.1.140.0050.00217.41
8.1.130.0000.00717.89
8.1.120.0000.00717.59
8.1.110.0040.00417.47
8.1.100.0080.00017.44
8.1.90.0000.00717.42
8.1.80.0000.00717.41
8.1.70.0030.00317.48
8.1.60.0040.00417.52
8.1.50.0000.00817.61
8.1.40.0000.00817.52
8.1.30.0050.00317.52
8.1.20.0040.00417.73
8.1.10.0000.00817.69
8.1.00.0070.00317.59
8.0.300.0040.00418.77
8.0.290.0000.00717.30
8.0.280.0050.00218.56
8.0.270.0000.00717.36
8.0.260.0040.00417.02
8.0.250.0030.00417.15
8.0.240.0040.00417.13
8.0.230.0070.00017.02
8.0.220.0080.00017.05
8.0.210.0000.00717.04
8.0.200.0040.00417.06
8.0.190.0040.00417.13
8.0.180.0070.00017.11
8.0.170.0030.00317.13
8.0.160.0000.00817.00
8.0.150.0000.00817.05
8.0.140.0040.00416.88
8.0.130.0030.00313.45
8.0.120.0000.00917.07
8.0.110.0050.00216.99
8.0.100.0030.00517.11
8.0.90.0030.00616.99
8.0.80.0080.00817.04
8.0.70.0050.00317.10
8.0.60.0050.00317.02
8.0.50.0040.00417.11
8.0.30.0080.01117.22
8.0.20.0060.01317.40
8.0.10.0050.00317.17
8.0.00.0100.00916.89
7.4.330.0020.00215.00
7.4.320.0060.00016.51
7.4.300.0000.00816.51
7.4.290.0000.00716.54
7.4.280.0060.00316.55
7.4.270.0000.00816.55
7.4.260.0070.00016.61
7.4.250.0000.00816.59
7.4.240.0020.00516.61
7.4.230.0030.00316.59
7.4.220.0200.00616.67
7.4.210.0070.00716.58
7.4.200.0000.00716.69
7.4.190.0030.00316.52
7.4.160.0100.00716.67
7.4.150.0100.00717.40
7.4.140.0110.00617.86
7.4.130.0060.01216.59
7.4.120.0080.01116.76
7.4.110.0100.00716.71
7.4.100.0160.00416.65
7.4.90.0070.01016.71
7.4.80.0060.01319.39
7.4.70.0110.00716.51
7.4.60.0090.00616.50
7.4.50.0030.00516.68
7.4.40.0040.01522.77
7.4.30.0100.00616.56
7.4.00.0000.01314.82
7.3.330.0000.00513.35
7.3.320.0030.00313.54
7.3.310.0030.00316.63
7.3.300.0070.00016.44
7.3.290.0030.01216.52
7.3.280.0090.00816.58
7.3.270.0180.00917.40
7.3.260.0150.00416.43
7.3.250.0080.00916.55
7.3.240.0170.00316.55
7.3.230.0110.00716.54
7.3.210.0080.00916.52
7.3.200.0040.01919.39
7.3.190.0090.00916.53
7.3.180.0030.01316.72
7.3.170.0180.00616.59
7.3.160.0120.00616.57
7.3.120.0090.00414.86
7.2.330.0140.00316.73
7.2.320.0130.01016.48
7.2.310.0110.00616.94
7.2.300.0120.00616.90
7.2.290.0060.01116.82
7.2.110.0190.00316.51
7.2.100.0150.00516.41
7.2.90.0210.00016.64
7.2.80.0100.01016.84
7.2.70.0160.00017.04
7.2.60.0040.01317.07
7.2.50.0170.00316.72
7.2.40.0160.00317.00
7.2.30.0130.00517.13
7.2.20.0180.00316.75
7.2.10.0070.01016.87
7.2.00.0190.01218.32
7.1.230.0070.00715.89
7.1.220.0090.00915.97
7.1.210.0170.00615.88
7.1.200.0730.00515.48
7.1.190.0100.00715.79
7.1.180.0080.00815.55
7.1.170.0380.00615.69
7.1.160.0040.01315.85
7.1.150.0120.00615.99
7.1.140.0130.00415.52
7.1.130.0130.00615.93
7.1.120.0100.00515.79
7.1.110.0060.01515.72
7.1.100.0060.00917.20
7.1.90.0120.00715.91
7.1.80.0710.00015.85
7.1.70.0060.00516.61
7.1.60.0080.01317.74
7.1.50.0160.00916.70
7.1.40.0140.00615.71
7.1.30.0120.00915.87
7.1.20.0120.01115.76
7.1.10.0060.00615.62
7.1.00.0080.03019.12
7.0.310.0130.00515.33
7.0.300.0150.00615.11
7.0.290.0130.00015.16
7.0.280.0270.01015.18
7.0.270.0100.00515.52
7.0.260.0160.00315.48
7.0.250.0320.00715.31
7.0.240.0160.00315.20
7.0.230.0380.00715.48
7.0.220.0110.00515.36
7.0.210.0100.00615.63
7.0.200.0100.00216.39
7.0.190.0110.00515.59
7.0.180.0110.00415.46
7.0.170.0080.00815.38
7.0.160.0110.00715.63
7.0.150.0070.01115.55
7.0.140.0060.03818.87
7.0.130.0190.00015.21
7.0.120.0070.00715.36
7.0.110.0090.00615.54
7.0.100.0140.00415.38
7.0.90.0080.00815.19
7.0.80.0090.00615.45
7.0.70.0100.00215.43
7.0.60.0100.02217.80
7.0.50.0120.04216.81
7.0.40.0070.02517.02
7.0.30.0190.03717.00
7.0.20.0160.03016.89
7.0.10.0160.04316.97
7.0.00.0060.03117.06
5.6.380.0120.00314.65
5.6.370.0170.00014.69
5.6.360.0190.00014.45
5.6.350.0120.00414.63
5.6.340.0160.00314.20
5.6.330.0100.00714.47
5.6.320.0040.01114.57
5.6.310.0130.00014.61
5.6.300.0110.00814.46
5.6.290.0120.00414.61
5.6.280.0080.03718.00
5.6.270.0170.00014.80
5.6.260.0130.00314.48
5.6.250.0100.00514.17
5.6.240.0100.00814.61
5.6.230.0120.00414.55
5.6.220.0160.00614.28
5.6.210.0140.04117.73
5.6.200.0120.04316.48
5.6.190.0070.02617.77
5.6.180.1800.02117.71
5.6.170.0190.04117.50
5.6.160.0080.03117.60
5.6.150.0080.02916.54
5.6.140.0100.02116.62
5.6.130.0110.04316.67
5.6.120.0060.02517.87
5.6.110.0110.03817.88
5.6.100.0140.02717.93
5.6.90.0120.04317.90
5.6.80.0110.04017.59
5.6.70.0200.03517.67
5.6.60.0110.00714.45
5.6.50.0080.00814.63
5.6.40.0070.01114.46
5.6.30.0120.00414.36
5.6.20.0130.00414.57
5.6.10.0120.00314.49
5.6.00.0080.00514.41
5.5.380.0110.00412.79
5.5.370.0000.01112.79
5.5.360.0120.00412.79
5.5.350.0110.02216.83
5.5.340.0070.04115.50
5.5.330.0160.01716.78
5.5.320.0200.02516.71
5.5.310.0170.03516.70
5.5.300.0020.02615.52
5.5.290.0110.04015.53
5.5.280.0030.02916.95
5.5.270.0050.02516.94
5.5.260.0170.01717.02
5.5.250.0130.03816.94
5.5.240.0090.04216.61
5.5.230.0050.00512.79
5.5.220.0120.00312.79
5.5.210.0120.00312.79
5.5.200.0120.00012.79
5.5.190.0070.00712.79
5.5.180.0060.00612.79
5.5.170.0040.00914.38
5.5.160.0110.00412.79
5.5.150.0060.00612.79
5.5.140.0120.00012.79
5.5.130.0080.00312.79
5.5.120.0070.00712.79
5.5.110.0100.00312.79
5.5.100.0120.00312.79
5.5.90.0140.00012.79
5.5.80.0060.00912.79
5.5.70.0100.00312.79
5.5.60.0080.00612.79
5.5.50.0110.00412.79
5.5.40.0110.00412.79
5.5.30.0100.00012.79
5.5.20.0090.00412.79
5.5.10.0070.00712.79
5.5.00.0060.00912.79
5.4.450.0520.02216.19
5.4.440.0370.03516.32
5.4.430.0360.02916.16
5.4.420.0090.03316.15
5.4.410.0440.03116.26
5.4.400.0210.02615.77
5.4.390.0210.03615.79
5.4.380.0180.02915.87
5.4.370.0080.03015.97
5.4.360.0160.02615.94
5.4.350.0150.02815.92
5.4.340.0150.02515.92
5.4.330.0090.00512.79
5.4.320.0070.02512.66
5.4.310.0020.02612.65
5.4.300.0060.02212.65
5.4.290.0070.02012.66
5.4.280.0060.02312.60
5.4.270.0080.02712.60
5.4.260.0110.02715.80
5.4.250.0070.03216.00
5.4.240.0140.02316.02
5.4.230.0120.02915.93
5.4.220.0080.03015.94
5.4.210.0050.03015.83
5.4.200.0100.03716.02
5.4.190.0050.03316.01
5.4.180.0080.02515.99
5.4.170.0090.02815.95
5.4.160.0140.02515.98
5.4.150.0090.03015.98
5.4.140.0100.02714.72
5.4.130.0090.02514.70
5.4.120.0120.02114.60
5.4.110.0090.02714.63
5.4.100.0050.03014.67
5.4.90.0090.02514.66
5.4.80.0080.02714.65
5.4.70.0090.02414.72
5.4.60.0110.03114.60
5.4.50.0060.02814.58
5.4.40.0100.02514.57
5.4.30.0140.02014.60
5.4.20.0070.02714.66
5.4.10.0070.03114.66
5.4.00.0110.02414.32
5.3.290.0100.02712.80
5.3.280.0100.02713.63
5.3.270.0100.03313.78
5.3.260.0100.03713.75
5.3.250.0060.02913.78
5.3.240.0080.02813.74
5.3.230.0120.02413.66
5.3.220.0110.03313.73
5.3.210.0070.03013.78
5.3.200.0130.03113.68
5.3.190.0110.03013.70
5.3.180.0070.02913.80
5.3.170.0110.02213.61
5.3.160.0100.02413.70
5.3.150.0120.02313.72
5.3.140.0040.02813.61
5.3.130.0120.02713.63
5.3.120.0090.02813.75
5.3.110.0130.03913.69
5.3.100.0090.03413.47
5.3.90.0140.02113.46
5.3.80.0080.03713.45
5.3.70.0130.02213.50
5.3.60.0160.02013.41
5.3.50.0020.03813.42
5.3.40.0060.04013.33
5.3.30.0050.02513.39
5.3.20.0070.02913.29
5.3.10.0080.02713.32
5.3.00.0090.02613.34
5.2.170.0110.02512.02
5.2.160.0030.02812.07
5.2.150.0060.02311.94
5.2.140.0050.02211.97
5.2.130.0070.02012.01
5.2.120.0070.02312.01
5.2.110.0040.02312.00
5.2.100.0100.02212.04
5.2.90.0080.01811.88
5.2.80.0050.02311.95
5.2.70.0070.02012.00
5.2.60.0060.02211.98
5.2.50.0060.02411.87
5.2.40.0080.02011.89
5.2.30.0070.02211.93
5.2.20.0060.03011.93
5.2.10.0070.02211.95
5.2.00.0060.02311.80
5.1.60.0070.01711.43
5.1.50.0040.02011.46
5.1.40.0030.02411.38
5.1.30.0060.02011.49
5.1.20.0060.02111.62
5.1.10.0040.02211.42
5.1.00.0020.02411.47
5.0.50.0050.02010.67
5.0.40.0030.01710.54
5.0.30.0080.02210.58
5.0.20.0030.01710.48
5.0.10.0050.01310.53
5.0.00.0090.02010.53
4.4.90.0020.01410.02
4.4.80.0050.00910.02
4.4.70.0030.0139.87
4.4.60.0070.0099.78
4.4.50.0010.0139.68
4.4.40.0070.0179.48
4.4.30.0030.0119.48
4.4.20.0060.0129.48
4.4.10.0010.0159.48
4.4.00.0030.0189.48
4.3.110.0040.0119.48
4.3.100.0050.0109.48
4.3.90.0060.0079.48
4.3.80.0010.0189.48
4.3.70.0020.0139.48
4.3.60.0010.0169.48
4.3.50.0050.0129.48
4.3.40.0040.0199.48
4.3.30.0020.0139.48
4.3.20.0040.0149.48
4.3.10.0030.0129.48
4.3.00.0070.0159.78

preferences:
52.68 ms | 401 KiB | 5 Q