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":"26974884000179"},"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.00316.75
8.3.50.0070.01116.53
8.3.40.0140.00318.96
8.3.30.0070.00718.65
8.3.20.0000.00720.16
8.3.10.0040.00421.63
8.3.00.0080.00019.68
8.2.180.0140.00416.35
8.2.170.0040.01122.96
8.2.160.0070.00719.07
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00419.36
8.2.120.0040.00426.35
8.2.110.0100.00020.99
8.2.100.0110.00617.70
8.2.90.0050.00319.28
8.2.80.0030.00517.97
8.2.70.0040.00417.75
8.2.60.0030.00618.05
8.2.50.0030.00618.07
8.2.40.0050.00520.07
8.2.30.0040.00417.95
8.2.20.0040.00418.14
8.2.10.0070.00018.14
8.2.00.0040.00417.98
8.1.280.0170.00325.92
8.1.270.0000.00823.70
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0070.01519.64
8.1.230.0080.00419.06
8.1.220.0040.00417.79
8.1.210.0000.00818.77
8.1.200.0070.00317.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0060.00318.61
8.1.160.0040.00418.95
8.1.150.0060.00320.57
8.1.140.0030.00619.51
8.1.130.0030.00318.82
8.1.120.0040.00417.45
8.1.110.0040.00417.32
8.1.100.0060.00317.42
8.1.90.0040.00417.42
8.1.80.0040.00417.43
8.1.70.0040.00417.39
8.1.60.0060.00317.60
8.1.50.0030.00517.52
8.1.40.0000.00817.59
8.1.30.0060.00317.67
8.1.20.0050.00217.73
8.1.10.0000.00917.50
8.1.00.0000.00717.44
8.0.300.0000.00818.77
8.0.290.0000.00916.75
8.0.280.0030.00318.34
8.0.270.0030.00317.30
8.0.260.0000.00616.82
8.0.250.0040.00416.94
8.0.240.0030.00616.90
8.0.230.0050.00316.97
8.0.220.0000.00716.78
8.0.210.0000.00716.91
8.0.200.0000.00816.99
8.0.190.0030.00616.95
8.0.180.0040.00416.87
8.0.170.0040.00416.97
8.0.160.0000.00716.99
8.0.150.0020.00516.89
8.0.140.0070.00016.89
8.0.130.0050.00013.32
8.0.120.0070.00016.89
8.0.110.0050.00216.78
8.0.100.0040.00416.90
8.0.90.0060.00316.96
8.0.80.0110.01116.92
8.0.70.0050.00316.86
8.0.60.0080.00016.93
8.0.50.0040.00416.91
8.0.30.0110.00817.15
8.0.20.0100.01117.40
8.0.10.0000.00716.79
8.0.00.0140.00416.79
7.4.330.0000.00515.55
7.4.320.0030.00316.54
7.4.300.0000.00616.61
7.4.290.0070.00016.42
7.4.280.0080.00016.45
7.4.270.0000.00716.63
7.4.260.0020.00516.64
7.4.250.0000.00716.42
7.4.240.0050.00316.68
7.4.230.0040.00416.32
7.4.220.0070.01116.65
7.4.210.0090.00616.61
7.4.200.0040.00416.43
7.4.160.0070.01016.56
7.4.150.0060.01117.40
7.4.140.0140.00517.86
7.4.130.0100.01316.54
7.4.120.0100.01116.41
7.4.110.0040.01516.52
7.4.100.0120.00616.54
7.4.90.0130.00316.48
7.4.80.0060.01219.39
7.4.70.0070.01416.64
7.4.60.0030.01316.51
7.4.50.0070.00416.62
7.4.40.0090.00916.48
7.4.30.0170.00616.46
7.4.00.0060.00814.97
7.3.330.0060.00013.35
7.3.320.0030.00313.18
7.3.310.0030.00316.36
7.3.300.0030.00316.19
7.3.290.0120.00716.33
7.3.280.0080.00816.31
7.3.270.0150.01217.40
7.3.260.0140.00616.49
7.3.250.0100.00816.49
7.3.240.0150.00616.29
7.3.230.0150.00916.31
7.3.210.0110.00616.29
7.3.200.0090.00916.46
7.3.190.0080.00816.29
7.3.180.0070.01016.50
7.3.170.0140.00316.41
7.3.160.0100.01016.56
7.3.120.0060.01314.65
7.3.110.0030.01314.41
7.3.100.0070.00714.64
7.3.90.0030.00614.86
7.3.80.0080.00314.53
7.3.70.0090.00014.79
7.3.60.0040.01114.59
7.3.50.0000.00814.75
7.3.40.0040.00814.94
7.3.30.0060.00614.70
7.3.20.0000.01116.40
7.3.10.0060.00316.50
7.3.00.0040.01216.60
7.2.330.0100.01016.47
7.2.320.0030.01316.78
7.2.310.0030.01316.51
7.2.300.0100.00616.79
7.2.290.0030.01316.86
7.2.250.0060.01014.84
7.2.240.0070.01014.98
7.2.230.0000.01815.22
7.2.220.0060.00914.99
7.2.210.0070.00715.11
7.2.200.0130.00015.10
7.2.190.0000.00915.00
7.2.180.0090.00615.01
7.2.170.0120.00315.03
7.2.90.1600.00314.78
7.2.80.1600.00314.66
7.2.70.1170.00614.55
7.2.60.1120.01014.64
7.2.50.1270.00314.71
7.2.40.1260.00314.88
7.2.30.0960.01314.82
7.2.20.1250.00314.91
7.2.10.1010.00914.89
7.2.00.0920.01014.67
7.1.330.0040.01115.56
7.1.320.0000.01215.86
7.1.310.0030.00915.66
7.1.300.0060.00315.71
7.1.290.0000.00815.47
7.1.280.0030.01215.67
7.1.270.0090.00315.63
7.1.260.0000.01415.43
7.1.210.1930.00013.85
7.1.200.1200.01213.73
7.1.190.1180.01013.79
7.1.180.1160.01013.63
7.1.170.1220.01013.75
7.1.160.1180.00713.71
7.1.150.1050.00013.87
7.1.140.1080.00913.69
7.1.130.1020.01314.00
7.1.120.1100.00613.82
7.1.110.1230.00713.79
7.1.100.0920.00713.73
7.1.90.1100.00713.81
7.1.80.1090.00613.55
7.1.70.0750.00713.50
7.1.60.1780.01731.29
7.1.50.0810.00631.70
7.1.40.0680.00631.70
7.1.30.1040.00731.68
7.1.20.0780.00031.55
7.1.10.0620.00313.82
7.1.00.0480.01313.98
7.0.310.1660.00313.11
7.0.300.1180.00713.40
7.0.290.1130.00313.73
7.0.280.1090.00713.31
7.0.270.1140.00713.55
7.0.260.1120.00613.70
7.0.250.0990.00713.54
7.0.240.0820.01613.43
7.0.230.1180.00313.49
7.0.220.1140.01013.77
7.0.210.0900.00313.73
7.0.200.0840.00713.74
7.0.190.0670.01013.36
7.0.180.0620.01113.54
7.0.170.0600.01013.70
7.0.160.0760.01013.32
7.0.150.0580.00413.51
7.0.140.0510.01313.67
7.0.130.0900.00613.58
7.0.120.0430.01313.41
7.0.110.0900.00313.64
7.0.100.0440.01713.66
7.0.90.0490.01413.71
7.0.80.0870.00013.66
7.0.70.0490.00613.46
7.0.60.0690.01313.67
7.0.50.0510.00813.69
7.0.40.0550.00713.76
7.0.30.0460.01313.73
7.0.20.0520.00613.65
7.0.10.0490.00713.38
7.0.00.0450.01013.63

preferences:
44.89 ms | 401 KiB | 5 Q