3v4l.org

run code in 300+ PHP versions simultaneously
<?php class header { private $secretKey = '123'; private $storeId = 10; public function __construct($content, $url) { $this->setContentMd5($content); $this->setHttpVerb($url); } private function setContentMd5($content) { $this->contentMd5 = md5($content); } private function setHttpVerb($url) { if (parse_url($url, PHP_URL_QUERY)) { $this->httpVerb = parse_url($url, PHP_URL_PATH).'?'.parse_url($url, PHP_URL_QUERY); } else { $this->httpVerb = parse_url($url, PHP_URL_PATH); } } private function generateAuthorization() { return hash_hmac( 'sha256', $this->httpVerb . $this->contentMd5, $this->secretKey ); } public function generateHeader() { $headers = array( 'Accept' => 'application/vnd.boacompra.com.v1+json; charset=UTF-8', 'Content-Type' => 'application/json', 'Content-MD5' => $this->contentMd5, 'Authorization' => $this->storeId . ':' . $this->generateAuthorization() ); return $headers; } } echo 'POST EXAMPLE <br /> <pre>'; $content = '{"payment-method":{"reference":"ID-CND","direct-token":"ndsfjnasdfnsdakfjndsakfjndsakfjnasdkfasdfdsf==","notify-url":"https://virtual-store.com/notifications/","test-mode":0,"payment-group":"credit_card","country":"BR","language":"en-US"},"payer":{"name":"Payer Pagador","email":"payer@uolinc.com","phone-area-code":"11","phone-number":"988881234","document":{"type":"CNPJ","number":"26.974.884/0001-79"},"birth-date":"1982-12-20"}}'; $headerPost = new header($content, 'https://api.boacompra.com/payment-methods'); print_r($headerPost->generateHeader());

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.0110.00716.88
8.3.50.0100.00716.43
8.3.40.0070.00718.82
8.3.30.0160.00018.94
8.3.20.0080.00020.38
8.3.10.0040.00421.91
8.3.00.0000.00819.68
8.2.180.0110.01116.47
8.2.170.0040.01122.96
8.2.160.0090.00619.16
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00419.39
8.2.120.0040.00426.35
8.2.110.0030.00720.52
8.2.100.0090.00317.80
8.2.90.0000.00819.17
8.2.80.0000.00818.04
8.2.70.0080.00017.75
8.2.60.0000.00818.05
8.2.50.0000.00818.10
8.2.40.0000.00820.36
8.2.30.0000.00821.02
8.2.20.0000.00717.99
8.2.10.0040.00418.10
8.2.00.0000.00817.95
8.1.280.0140.00325.92
8.1.270.0000.00722.14
8.1.260.0050.00226.35
8.1.250.0000.00828.09
8.1.240.0080.00022.04
8.1.230.0070.00419.14
8.1.220.0000.00817.79
8.1.210.0030.00618.77
8.1.200.0060.00317.23
8.1.190.0080.00017.25
8.1.180.0060.00318.10
8.1.170.0000.00818.58
8.1.160.0040.00419.10
8.1.150.0040.00420.67
8.1.140.0060.00319.47
8.1.130.0000.00718.92
8.1.120.0040.00417.45
8.1.110.0000.00817.34
8.1.100.0080.00017.42
8.1.90.0040.00417.48
8.1.80.0050.00317.36
8.1.70.0040.00417.48
8.1.60.0040.00417.56
8.1.50.0030.00517.53
8.1.40.0040.00417.45
8.1.30.0000.00817.66
8.1.20.0000.00717.66
8.1.10.0000.00717.66
8.1.00.0030.00617.50
8.0.300.0040.00419.94
8.0.290.0080.00016.75
8.0.280.0030.00318.46
8.0.270.0040.00417.32
8.0.260.0070.00016.75
8.0.250.0030.00317.01
8.0.240.0030.00817.00
8.0.230.0070.00016.87
8.0.220.0040.00416.92
8.0.210.0040.00416.95
8.0.200.0040.00416.93
8.0.190.0060.00316.95
8.0.180.0050.00316.82
8.0.170.0070.00016.93
8.0.160.0030.00416.91
8.0.150.0050.00216.89
8.0.140.0000.00716.85
8.0.130.0050.00013.41
8.0.120.0030.00616.88
8.0.110.0000.00716.94
8.0.100.0070.00016.79
8.0.90.0040.00416.81
8.0.80.0160.00816.86
8.0.70.0030.00616.87
8.0.60.0000.00816.80
8.0.50.0000.00716.78
8.0.30.0040.01517.08
8.0.20.0090.01217.40
8.0.10.0030.00316.95
8.0.00.0100.00617.11
7.4.330.0060.00015.55
7.4.320.0030.00616.67
7.4.300.0000.00616.57
7.4.290.0000.00716.66
7.4.280.0040.00416.51
7.4.270.0030.00316.51
7.4.260.0030.00616.54
7.4.250.0020.00516.59
7.4.240.0030.00316.53
7.4.230.0000.00716.36
7.4.220.0070.01116.46
7.4.210.0070.00716.65
7.4.200.0020.00516.69
7.4.160.0140.00216.53
7.4.150.0090.00917.40
7.4.140.0110.00917.86
7.4.130.0110.00716.53
7.4.120.0130.00816.41
7.4.110.0040.01516.46
7.4.100.0130.00316.52
7.4.90.0100.00716.54
7.4.80.0140.00719.39
7.4.70.0100.00716.38
7.4.60.0150.00616.52
7.4.50.0030.01016.55
7.4.40.0130.00916.34
7.4.30.0100.00716.39
7.4.00.0080.00915.03
7.3.330.0050.00313.15
7.3.320.0000.00613.34
7.3.310.0040.00416.28
7.3.300.0000.00716.34
7.3.290.0110.00716.32
7.3.280.0080.01116.30
7.3.270.0110.00617.40
7.3.260.0080.01016.47
7.3.250.0130.00516.54
7.3.240.0080.01116.37
7.3.230.0110.00816.20
7.3.210.0060.01016.34
7.3.200.0110.00716.44
7.3.190.0100.00616.65
7.3.180.0040.01116.24
7.3.170.0110.00716.62
7.3.160.0120.01216.66
7.3.120.0080.00815.61
7.3.110.0060.01015.58
7.3.100.0050.00715.67
7.3.90.0030.00915.58
7.3.80.0060.00615.67
7.3.70.0060.00515.44
7.3.60.0060.00815.64
7.3.50.0030.00815.47
7.3.40.0090.00615.57
7.3.30.0020.01115.64
7.3.20.0040.00716.75
7.3.10.0090.00716.80
7.3.00.0080.00416.91
7.2.330.0120.00616.76
7.2.320.0030.01316.89
7.2.310.0100.00716.44
7.2.300.0030.01316.81
7.2.290.0040.01316.79
7.2.250.0070.00914.97
7.2.240.0010.01615.80
7.2.230.0050.00915.71
7.2.220.0080.00915.85
7.2.210.0070.00415.72
7.2.200.0090.00515.74
7.2.190.0040.00915.69
7.2.180.0060.00715.77
7.2.170.0110.00515.67
7.2.160.0040.01217.15
7.2.150.0070.00717.15
7.2.140.0080.00417.15
7.2.130.0090.00617.15
7.2.120.0070.01017.15
7.2.110.0080.00417.15
7.2.100.0090.00617.15
7.2.90.0070.00915.99
7.2.80.0090.01015.95
7.2.70.1180.01016.18
7.2.60.0130.00416.04
7.2.50.0180.00616.03
7.2.40.0070.01416.10
7.2.30.0070.00716.22
7.2.20.0150.00716.14
7.2.10.0100.00716.14
7.2.00.0300.00716.09
7.1.330.0060.00916.22
7.1.320.0070.00816.13
7.1.310.0120.00316.08
7.1.300.0050.00516.15
7.1.290.0070.00816.22
7.1.280.0090.00516.09
7.1.270.0070.00816.13
7.1.260.0050.01016.13
7.1.250.0120.00317.15
7.1.210.0050.01613.83
7.1.200.0130.00613.86
7.1.190.0130.00613.96
7.1.180.1950.00613.95
7.1.170.0830.00713.60
7.1.160.0100.00613.93
7.1.150.0100.00713.74
7.1.140.0030.01513.82
7.1.130.0060.00613.83
7.1.120.0090.00713.94
7.1.110.0130.00413.88
7.1.100.0200.01013.90
7.1.90.0660.00513.63
7.1.80.0270.00613.82
7.1.70.0100.00713.93
7.1.60.0210.01831.98
7.1.50.1200.01032.00
7.1.40.0330.01131.66
7.1.30.0560.01231.73
7.1.20.0700.01231.89
7.1.10.0480.00613.58
7.1.00.0290.00413.64
7.0.310.0090.01013.77
7.0.300.0140.00313.54
7.0.290.0190.00713.44
7.0.280.0040.01513.51
7.0.270.0230.00313.30
7.0.260.0560.00713.47
7.0.250.1260.00713.82
7.0.240.0220.00013.65
7.0.230.0190.00613.82
7.0.220.0110.00813.62
7.0.210.0430.01213.42
7.0.200.0230.00913.69
7.0.190.1780.00313.44
7.0.180.0550.01013.57
7.0.170.1160.00313.49
7.0.160.0220.00313.62
7.0.150.0110.01013.59
7.0.140.0240.00713.57
7.0.130.0450.00513.44
7.0.120.0290.00413.42
7.0.110.0390.00713.44
7.0.100.0130.00613.47
7.0.90.1240.00313.44
7.0.80.0260.00013.73
7.0.70.0150.00513.60
7.0.60.0110.01113.38
7.0.50.1910.00313.77
7.0.40.0830.01313.81
7.0.30.0640.01113.69
7.0.20.0340.00713.38
7.0.10.0190.00813.59
7.0.00.0170.00613.78

preferences:
77.72 ms | 401 KiB | 5 Q