3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Grada\REST; use \Grada\REST\Curl; class Client { private $language = ''; private $hashing_key = ''; function __construct($hashing_key, $language='en-US') { $this->language = $language; $this->hashing_key = $hashing_key; } public function call($url, $method, $vars, $headers) { if (!array_key_exists('app_key', $headers)) $headers['app_key'] = $vars['app_key']; if (!array_key_exists('user_email', $headers)) $headers['user_email'] = $vars['user_email']; if (!array_key_exists('auth_token', $headers)) $headers['auth_token'] = ''; $headers['Accept-Language'] = $this->language; $headers['request_timestamp'] = gmdate('c'); $headers['request_body'] = $vars; $headers['request_url'] = $url; $headers['request_method'] = $method; $headers['api_signature'] = $this->get_signature($headers); $request_body = $this->encode_post_data($vars); $headers['request_body'] = $request_body; $url = $this->encode_query_string($url); $headers['request_url'] = $url; $curl = new Curl(); $curl->headers = $headers; $response = $curl->request(strtoupper($method), $url, $vars); $rv = array(); $rv['body'] = json_decode($response->body, true); $rv['headers'] = $response->headers; $rv['exception'] =$rv['body']['exception']; $rv['http_status_code'] = $rv['body']['http_status_code']; $rv['auth_token'] = $rv['body']['auth_token']; $rv['body'] = $rv['body']['body']; return $rv; } function encode_query_string($url) { $pos = strpos($url, '?',0); if ($pos !== false) { $qs = substr($url,$pos+1); $qs = rawurlencode(urldecode($qs)); $url = substr($url,0, $pos+1) . $qs; } return $url; } function encode_post_data($vars) { $request_body = ''; if ($vars) { foreach ($vars AS $key=>$value) { if (is_array($value)) $request_body .= $this->urlencode_array($value, $key).'&'; else $request_body .= $key.'='.$value.'&'; } $request_body = rtrim($request_body, '&'); } return $request_body; } function get_signature($vars) { $key = $this->hashing_key; $message = $vars['auth_token'] . $vars['app_key'] . $vars['user_email'] . $vars['request_timestamp'] . $this->encode_post_data($vars['request_body']) .$this->encode_query_string($vars['request_url']) . $vars['request_method']; return base64_encode(hash_hmac('sha512', $message, hash('sha512', $this->hashing_key))); } function urlencode_array($var, $varName, $separator = '&') { $toImplode = array(); foreach ($var as $key => $value) { if (is_array($value)) $toImplode[] = urlencode_array($value, "{$varName}[{$key}]", $separator); else $toImplode[] = "{$varName}[{$key}]=".rawurlencode(urldecode($value)); } return implode($separator, $toImplode); } } ?>

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.0070.00718.18
8.3.50.0240.00522.06
8.3.40.0070.00718.55
8.3.30.0120.00918.88
8.3.20.0000.00720.21
8.3.10.0050.00323.66
8.3.00.0030.00520.57
8.2.180.0030.01218.18
8.2.170.0090.00622.96
8.2.160.0140.00022.21
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0000.00822.43
8.2.110.0070.00322.29
8.2.100.0060.00617.78
8.2.90.0170.00018.79
8.2.80.0050.00317.97
8.2.70.0000.01317.50
8.2.60.0000.00817.92
8.2.50.0040.00418.07
8.2.40.0040.00418.07
8.2.30.0000.00918.14
8.2.20.0000.00917.55
8.2.10.0060.00317.75
8.2.00.0080.00017.57
8.1.280.0040.01125.92
8.1.270.0060.00323.90
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.96
8.1.230.0080.00319.29
8.1.220.0030.00617.74
8.1.210.0050.00318.77
8.1.200.0030.00617.23
8.1.190.0050.00317.53
8.1.180.0040.00418.10
8.1.170.0000.00818.67
8.1.160.0020.00521.96
8.1.150.0000.00718.61
8.1.140.0040.00417.41
8.1.130.0000.00717.85
8.1.120.0020.00517.50
8.1.110.0000.00717.49
8.1.100.0000.00717.35
8.1.90.0000.00817.38
8.1.80.0050.00217.30
8.1.70.0030.00617.32
8.1.60.0080.00017.40
8.1.50.0050.00317.52
8.1.40.0040.00417.37
8.1.30.0000.00817.48
8.1.20.0080.00017.52
8.1.10.0070.00317.49
8.1.00.0040.00417.40
8.0.300.0000.00818.77
8.0.290.0000.00817.18
8.0.280.0030.00318.45
8.0.270.0000.00817.22
8.0.260.0000.00616.77
8.0.250.0030.00316.82
8.0.240.0000.00716.81
8.0.230.0000.00816.96
8.0.220.0000.00716.83
8.0.210.0080.00016.84
8.0.200.0060.00016.94
8.0.190.0040.00416.98
8.0.180.0000.00716.91
8.0.170.0000.00816.89
8.0.160.0000.00716.73
8.0.150.0080.00016.73
8.0.140.0000.00716.71
8.0.130.0000.00513.24
8.0.120.0040.00416.85
8.0.110.0050.00316.77
8.0.100.0000.00716.92
8.0.90.0000.00716.91
8.0.80.0140.00016.82
8.0.70.0080.00016.85
8.0.60.0000.00716.66
8.0.50.0060.00316.97
8.0.30.0100.00917.09
8.0.20.0090.01217.40
8.0.10.0000.00816.98
8.0.00.0060.01216.77
7.4.330.0000.00515.00
7.4.320.0070.00016.45
7.4.300.0090.00016.48
7.4.290.0040.00416.33
7.4.280.0070.00016.41
7.4.270.0060.00016.58
7.4.260.0030.00316.45
7.4.250.0000.00716.38
7.4.240.0040.00316.47
7.4.230.0030.00316.57
7.4.220.0140.00316.50
7.4.210.0060.00916.56
7.4.200.0070.00016.27
7.4.190.0030.00516.73
7.4.160.0080.00816.43
7.4.150.0070.01317.40
7.4.140.0100.01017.86
7.4.130.0110.00516.40
7.4.120.0150.00516.47
7.4.110.0150.00316.50
7.4.100.0130.00616.42
7.4.90.0150.00816.53
7.4.80.0150.00316.50
7.4.70.0090.00916.33
7.4.60.0090.00916.45
7.4.50.0060.00316.62
7.4.40.0040.01222.77
7.4.30.0030.01316.43
7.4.00.0070.01114.97
7.3.330.0030.00313.20
7.3.320.0000.00513.02
7.3.310.0040.00416.30
7.3.300.0070.00016.22
7.3.290.0090.00616.26
7.3.280.0100.00716.24
7.3.270.0070.01017.40
7.3.260.0130.00316.37
7.3.250.0100.00716.38
7.3.240.0070.01616.43
7.3.230.0110.00916.39
7.3.210.0110.00716.14
7.3.200.0190.00419.39
7.3.190.0120.01216.54
7.3.180.0060.01016.40
7.3.170.0110.00616.52
7.3.160.0030.01616.39
7.3.120.0030.01514.79
7.2.330.0060.01216.43
7.2.320.0100.01016.41
7.2.310.0100.00716.45
7.2.300.0040.01416.43
7.2.290.0090.01216.46
7.2.60.0040.00416.55
7.2.50.0040.00816.47
7.2.00.0060.00618.91
7.1.200.0080.00415.42
7.1.100.0980.00916.09
7.1.70.0030.00616.97
7.1.60.0090.01219.27
7.1.50.0070.01416.96
7.1.00.0000.08022.35
7.0.200.0030.01016.74
7.0.140.0070.07022.00
7.0.100.0230.05720.24
7.0.90.0000.04320.01
7.0.80.0130.03019.99
7.0.70.0030.07720.04
7.0.60.0130.08320.05
7.0.50.0330.05720.40
7.0.40.0030.08020.05
7.0.30.0070.04020.13
7.0.20.0000.04720.05
7.0.10.0100.06320.05
7.0.00.0100.07720.02
5.6.280.0030.07021.11
5.6.250.0100.06020.75
5.6.240.0030.04320.67
5.6.230.0000.04320.61
5.6.220.0100.05020.66
5.6.210.0000.06020.55
5.6.200.0200.06721.14
5.6.190.0100.07721.05
5.6.180.0100.08021.02
5.6.170.0070.08021.09
5.6.160.0200.06721.07
5.6.150.0100.08021.14
5.6.140.0000.07020.98
5.6.130.0100.08721.04
5.6.120.0070.04321.20
5.6.110.0070.04021.07
5.6.100.0170.07021.06
5.6.90.0030.05321.07
5.6.80.0130.04320.44
5.6.70.0070.05020.45
5.6.60.0200.07720.45
5.6.50.0170.05320.45
5.6.40.0070.08320.34
5.6.30.0130.04720.44
5.6.20.0070.07720.48
5.6.10.0130.04020.29
5.6.00.0070.07720.30
5.5.380.0130.03020.41
5.5.370.0000.04320.60
5.5.360.0030.08020.43
5.5.350.0030.04720.46
5.5.340.0170.06720.95
5.5.330.0070.07320.87
5.5.320.0200.07020.95
5.5.310.0000.04320.96
5.5.300.0130.07720.86
5.5.290.0130.08020.87
5.5.280.0000.04720.81
5.5.270.0070.06020.93
5.5.260.0100.06720.92
5.5.250.0100.05720.64
5.5.240.0100.05320.19
5.5.230.0070.04720.32
5.5.220.0070.08320.34
5.5.210.0170.07720.21
5.5.200.0170.04320.03
5.5.190.0000.05720.29
5.5.180.0030.06020.21
5.5.160.0130.06720.14
5.5.150.0100.06020.24
5.5.140.0170.04720.17
5.5.130.0100.06720.14
5.5.120.0130.07720.11
5.5.110.0100.06020.20
5.5.100.0070.07020.10
5.5.90.0030.07020.19
5.5.80.0100.04020.16
5.5.70.0100.08320.20
5.5.60.0130.07320.09
5.5.50.0070.04320.09
5.5.40.0030.07320.11
5.5.30.0030.04320.08
5.5.20.0100.06320.10
5.5.10.0230.03020.07
5.5.00.0100.03720.06
5.4.450.0100.07719.23
5.4.440.0100.07719.48
5.4.430.0070.07319.45
5.4.420.0130.05319.36
5.4.410.0070.04319.29
5.4.400.0070.03719.13
5.4.390.0030.07018.88
5.4.380.0100.06019.04
5.4.370.0170.03719.03
5.4.360.0030.04719.20
5.4.350.0030.04019.15
5.4.340.0170.05018.85
5.4.320.0030.04318.90
5.4.310.0130.06318.84
5.4.300.0030.04718.87
5.4.290.0100.05319.06
5.4.280.0100.07319.08
5.4.270.0070.06319.13
5.4.260.0130.06719.12
5.4.250.0000.05319.20
5.4.240.0130.06318.86
5.4.230.0070.05318.94
5.4.220.0130.05319.03
5.4.210.0070.06718.93
5.4.200.0100.05019.02
5.4.190.0070.03719.23
5.4.180.0070.06019.11
5.4.170.0030.04019.11
5.4.160.0130.03019.00
5.4.150.0030.04019.20
5.4.140.0030.04016.26
5.4.130.0000.04016.34
5.4.120.0030.03716.51
5.4.110.0070.03316.34
5.4.100.0030.03716.34
5.4.90.0030.03716.51
5.4.80.0000.03016.48
5.4.70.0070.03716.45
5.4.60.0070.02716.27
5.4.50.0000.03716.49
5.4.40.0100.02316.37
5.4.30.0030.03016.46
5.4.20.0030.03716.32
5.4.10.0030.03716.43
5.4.00.0000.03715.91
5.3.290.0100.07014.82
5.3.280.0000.07314.72
5.3.270.0100.03314.76
5.3.260.0070.03714.56
5.3.250.0070.03714.56
5.3.240.0100.03014.69
5.3.230.0070.03314.66
5.3.220.0070.03314.69
5.3.210.0000.04014.57
5.3.200.0030.04014.70
5.3.190.0030.04314.59
5.3.180.0070.02714.63
5.3.170.0070.03314.56
5.3.160.0000.03714.59
5.3.150.0030.03714.57
5.3.140.0000.03314.57
5.3.130.0000.04014.70
5.3.120.0000.03714.52
5.3.110.0070.02714.57
5.3.100.0000.04014.13
5.3.90.0070.03714.00
5.3.80.0030.04013.96
5.3.70.0070.02714.03
5.3.60.0070.03314.16
5.3.50.0030.03014.07
5.3.40.0030.03014.13
5.3.30.0100.04014.00
5.3.20.0070.03013.79
5.3.10.0030.04713.75
5.3.00.0000.03713.60
5.2.170.0030.02711.81
5.2.160.0030.03711.81
5.2.150.0000.03311.81
5.2.140.0000.02711.81
5.2.130.0000.03011.81
5.2.120.0030.02711.81
5.2.110.0130.01311.81
5.2.100.0030.03011.81
5.2.90.0000.03311.81
5.2.80.0100.02711.81
5.2.70.0000.03711.81
5.2.60.0000.03011.81
5.2.50.0000.02711.81
5.2.40.0030.02311.81
5.2.30.0000.03011.81
5.2.20.0000.02711.81
5.2.10.0030.02311.81
5.2.00.0000.02311.81
5.1.60.0070.02011.81
5.1.50.0070.05311.81
5.1.40.0070.03011.81
5.1.30.0030.05011.81
5.1.20.0030.05011.81
5.1.10.0000.03311.81
5.1.00.0070.05311.81
5.0.50.0100.04011.81
5.0.40.0000.03311.81
5.0.30.0030.03711.81
5.0.20.0000.04011.81
5.0.10.0070.03311.81
5.0.00.0000.06011.81
4.4.90.0000.01311.81
4.4.80.0030.01011.81
4.4.70.0000.01711.81
4.4.60.0070.01011.81
4.4.50.0000.01311.81
4.4.40.0000.02711.81
4.4.30.0030.03711.81
4.4.20.0030.03711.81
4.4.10.0030.01311.81
4.4.00.0000.04711.81
4.3.110.0030.03311.81
4.3.100.0000.03711.81
4.3.90.0100.01711.81
4.3.80.0000.06011.81
4.3.70.0070.03011.81
4.3.60.0000.02711.81
4.3.50.0000.03311.81
4.3.40.0030.05011.81
4.3.30.0000.02011.81
4.3.20.0000.03711.81
4.3.10.0030.03011.81
4.3.00.0030.01711.81

preferences:
43.07 ms | 401 KiB | 5 Q