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":"00000000191"},"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.0120.00617.00
8.3.50.0180.00016.47
8.3.40.0070.01119.02
8.3.30.0070.00718.63
8.3.20.0000.00720.25
8.3.10.0000.00721.77
8.3.00.0080.00019.78
8.2.180.0070.01116.63
8.2.170.0070.00722.96
8.2.160.0150.00018.92
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00419.16
8.2.120.0000.00726.35
8.2.110.0090.00020.38
8.2.100.0080.00417.98
8.2.90.0080.00019.22
8.2.80.0040.00418.05
8.2.70.0000.00817.63
8.2.60.0040.00417.80
8.2.50.0000.00818.10
8.2.40.0040.00420.31
8.2.30.0000.00821.09
8.2.20.0050.00217.96
8.2.10.0000.00817.96
8.2.00.0030.00518.08
8.1.280.0070.01125.92
8.1.270.0070.00022.13
8.1.260.0020.00526.35
8.1.250.0050.00328.09
8.1.240.0040.00423.77
8.1.230.0040.00819.10
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0070.00317.35
8.1.190.0060.00317.23
8.1.180.0000.00818.10
8.1.170.0040.00418.50
8.1.160.0080.00019.05
8.1.150.0080.00020.67
8.1.140.0070.00319.59
8.1.130.0070.00018.79
8.1.120.0030.00317.38
8.1.110.0000.00917.43
8.1.100.0060.00317.38
8.1.90.0000.00917.36
8.1.80.0080.00017.51
8.1.70.0000.00717.55
8.1.60.0040.00417.63
8.1.50.0060.00317.54
8.1.40.0040.00417.41
8.1.30.0050.00317.63
8.1.20.0000.00817.72
8.1.10.0060.00317.48
8.1.00.0050.00217.42
8.0.300.0040.00420.02
8.0.290.0040.00416.63
8.0.280.0000.00718.48
8.0.270.0070.00017.16
8.0.260.0030.00316.70
8.0.250.0030.00316.86
8.0.240.0060.00316.88
8.0.230.0000.00717.00
8.0.220.0000.00716.93
8.0.210.0000.00716.83
8.0.200.0060.00016.97
8.0.190.0000.00817.00
8.0.180.0050.00216.89
8.0.170.0000.00716.94
8.0.160.0030.00516.90
8.0.150.0050.00216.96
8.0.140.0070.00016.88
8.0.130.0060.00013.43
8.0.120.0060.00316.89
8.0.110.0000.00716.91
8.0.100.0040.00416.98
8.0.90.0040.00416.89
8.0.80.0120.00316.82
8.0.70.0040.00416.97
8.0.60.0000.00716.79
8.0.50.0030.00316.85
8.0.30.0100.00717.02
8.0.20.0110.00717.40
8.0.10.0050.00217.02
8.0.00.0030.01716.89
7.4.330.0000.00615.55
7.4.320.0030.00316.48
7.4.300.0060.00016.51
7.4.290.0030.00316.51
7.4.280.0060.00316.43
7.4.270.0030.00316.54
7.4.260.0040.00416.53
7.4.250.0030.00316.59
7.4.240.0050.00316.65
7.4.230.0070.00016.34
7.4.220.0090.01016.62
7.4.210.0090.00616.56
7.4.200.0080.00016.42
7.4.160.0080.00816.48
7.4.150.0070.01117.40
7.4.140.0100.00917.86
7.4.130.0160.00716.50
7.4.120.0100.01116.55
7.4.110.0040.01416.60
7.4.100.0150.00416.69
7.4.90.0100.00716.56
7.4.80.0130.00319.39
7.4.70.0100.00716.61
7.4.60.0030.01416.35
7.4.50.0070.00716.45
7.4.40.0060.01016.33
7.4.30.0070.01016.61
7.4.00.0090.00615.07
7.3.330.0000.00713.31
7.3.320.0050.00013.19
7.3.310.0070.00016.20
7.3.300.0040.00416.38
7.3.290.0050.01216.32
7.3.280.0100.00816.32
7.3.270.0180.00017.40
7.3.260.0070.01016.42
7.3.250.0100.00716.41
7.3.240.0080.01216.46
7.3.230.0100.01316.55
7.3.210.0100.00616.24
7.3.200.0110.01216.47
7.3.190.0140.00316.63
7.3.180.0100.00516.49
7.3.170.0080.00816.34
7.3.160.0090.01516.30
7.3.10.0030.01316.45
7.3.00.0000.01316.33
7.2.330.0060.01216.72
7.2.320.0110.00616.80
7.2.310.0050.01116.45
7.2.300.0100.00716.72
7.2.290.0110.00516.82
7.2.130.0040.00817.02
7.2.120.0120.00316.94
7.2.110.0080.00816.73
7.2.100.0090.00316.66
7.2.90.0140.00315.85
7.2.80.0110.00715.66
7.2.70.0300.00716.20
7.2.60.0900.00815.93
7.2.50.0040.01316.14
7.2.40.0320.01216.14
7.2.30.0050.01215.91
7.2.20.0050.01215.91
7.2.10.0040.00816.09
7.2.00.1930.00716.00
7.1.250.0050.00515.95
7.1.210.0210.00913.55
7.1.200.0820.00413.94
7.1.190.0790.00913.91
7.1.180.0300.00714.06
7.1.170.0420.00613.79
7.1.160.0120.00914.03
7.1.150.0050.01313.74
7.1.140.0100.00514.02
7.1.130.0110.00613.71
7.1.120.3250.01013.71
7.1.110.0220.00613.87
7.1.100.1230.01013.95
7.1.90.1820.00714.05
7.1.80.0130.01014.01
7.1.70.1930.00314.17
7.1.60.2010.01331.85
7.1.50.1700.01031.85
7.1.40.1150.00331.87
7.1.30.0880.01331.46
7.1.20.0820.00731.97
7.1.10.0330.00713.84
7.1.00.0140.00314.02
7.0.310.0050.01613.59
7.0.300.0890.00313.46
7.0.290.0100.01613.57
7.0.280.0560.00913.43
7.0.270.1140.00913.57
7.0.260.1690.00713.57
7.0.250.0280.00713.47
7.0.240.1180.00413.54
7.0.230.1750.01613.69
7.0.220.0260.01513.53
7.0.210.1340.01913.73
7.0.200.1720.01513.73
7.0.190.1350.01213.48
7.0.180.0820.01713.68
7.0.170.0880.01213.80
7.0.160.1980.01313.63
7.0.150.0190.00913.45
7.0.140.0150.00513.45
7.0.130.0830.00713.33
7.0.120.1030.00013.70
7.0.110.0130.01313.59
7.0.100.0730.01013.52
7.0.90.0560.00413.46
7.0.80.0090.01213.26
7.0.70.0150.00713.63
7.0.60.0680.01013.62
7.0.50.0950.00413.47
7.0.40.0110.01113.45
7.0.30.0170.01013.72
7.0.20.0130.01013.41
7.0.10.1080.00613.63
7.0.00.0240.00013.75

preferences:
47.49 ms | 401 KiB | 5 Q