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-CND5","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEifQ==","notify-url":"https://virtual-store.com/notifications/","test-mode":0,"payment-group":"credit_card","country":"BR","language":"en-US"},"payer":{"name":"João Pagão","email":"payer@uolinc.com","phone-area-code":"11","phone-number":"988881234","document":{"type":"CPF","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.0000.01518.67
8.3.50.0060.00816.65
8.3.40.0090.00618.92
8.3.30.0150.00319.01
8.3.20.0040.00420.29
8.3.10.0080.00023.84
8.3.00.0000.00819.79
8.2.180.0040.01918.18
8.2.170.0070.01022.96
8.2.160.0070.00719.27
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00419.33
8.2.120.0030.00526.35
8.2.110.0040.00420.43
8.2.100.0060.00617.84
8.2.90.0060.00619.16
8.2.80.0060.00318.05
8.2.70.0040.00417.63
8.2.60.0040.00818.16
8.2.50.0000.00818.10
8.2.40.0040.00420.32
8.2.30.0000.00719.18
8.2.20.0000.00718.09
8.2.10.0030.00518.08
8.2.00.0040.00418.03
8.1.280.0120.00325.92
8.1.270.0000.00822.20
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00422.67
8.1.230.0070.00319.09
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0000.00817.22
8.1.180.0040.00418.10
8.1.170.0060.00320.44
8.1.160.0040.00418.94
8.1.150.0070.00018.86
8.1.140.0070.00019.61
8.1.130.0000.00718.85
8.1.120.0060.00317.41
8.1.110.0080.00017.47
8.1.100.0080.00017.47
8.1.90.0020.00517.54
8.1.80.0000.00717.48
8.1.70.0040.00417.43
8.1.60.0000.00817.60
8.1.50.0050.00317.50
8.1.40.0000.00917.39
8.1.30.0050.00317.52
8.1.20.0060.00317.68
8.1.10.0070.00017.59
8.1.00.0040.00417.42
8.0.300.0090.00018.77
8.0.290.0040.00416.63
8.0.280.0040.00418.47
8.0.270.0030.00317.28
8.0.260.0000.00616.76
8.0.250.0030.00316.97
8.0.240.0030.00316.90
8.0.230.0030.00316.88
8.0.220.0070.00016.90
8.0.210.0040.00416.90
8.0.200.0000.00716.95
8.0.190.0040.00416.86
8.0.180.0040.00416.90
8.0.170.0070.00016.84
8.0.160.0030.00316.80
8.0.150.0000.00816.98
8.0.140.0030.00516.75
8.0.130.0000.00613.36
8.0.120.0000.00816.89
8.0.110.0000.00716.86
8.0.100.0080.00016.80
8.0.90.0040.00416.78
8.0.80.0090.00916.88
8.0.70.0030.00516.83
8.0.60.0030.00516.87
8.0.50.0060.00316.69
8.0.30.0130.00317.17
8.0.20.0070.01217.40
8.0.10.0040.00416.93
8.0.00.0100.01016.60
7.4.330.0050.00015.55
7.4.320.0060.00016.53
7.4.300.0030.00316.66
7.4.290.0090.00216.57
7.4.280.0050.00316.50
7.4.270.0000.00716.38
7.4.260.0050.00216.43
7.4.250.0030.00316.48
7.4.240.0080.00016.48
7.4.230.0070.00016.71
7.4.220.0090.00916.71
7.4.210.0080.00916.59
7.4.200.0070.00016.72
7.4.160.0080.00916.41
7.4.150.0000.01717.40
7.4.140.0130.00717.86
7.4.130.0140.00516.35
7.4.120.0110.00816.44
7.4.110.0090.00616.53
7.4.100.0070.01116.52
7.4.90.0100.00716.55
7.4.80.0160.00619.39
7.4.70.0100.00716.68
7.4.60.0030.01316.68
7.4.50.0080.00316.26
7.4.40.0030.01416.65
7.4.30.0100.00716.63
7.4.00.0000.01614.87
7.3.330.0050.00013.16
7.3.320.0060.00013.40
7.3.310.0050.00316.25
7.3.300.0040.00416.20
7.3.290.0100.00616.31
7.3.280.0080.00916.29
7.3.270.0000.01817.40
7.3.260.0120.00916.55
7.3.250.0120.00616.38
7.3.240.0100.00616.28
7.3.230.0100.00716.57
7.3.210.0080.00916.60
7.3.200.0120.00316.63
7.3.190.0130.00316.52
7.3.180.0090.00816.63
7.3.170.0100.00616.34
7.3.160.0030.01316.27
7.2.330.0040.01316.54
7.2.320.0150.00316.77
7.2.310.0030.01416.69
7.2.300.0060.00916.83
7.2.290.0120.00916.45
7.2.90.0190.00914.82
7.2.80.0400.00714.86
7.2.70.0420.00815.37
7.2.60.0220.00614.90
7.2.50.0150.00615.18
7.2.40.0450.00314.80
7.2.30.0530.00915.25
7.2.20.0510.00414.86
7.2.10.0390.00014.90
7.2.00.0400.01014.98
7.1.210.0310.00613.79
7.1.200.0580.00713.89
7.1.190.0720.00013.93
7.1.180.0450.01013.93
7.1.170.0160.00613.75
7.1.160.0310.00313.57
7.1.150.0150.00713.78
7.1.140.0390.00013.82
7.1.130.0400.00614.05
7.1.120.0240.01213.75
7.1.110.0150.00313.57
7.1.100.0340.00413.71
7.1.90.0090.01213.85
7.1.80.0390.00314.06
7.1.70.0500.00313.58
7.1.60.0610.01031.86
7.1.50.0480.01331.65
7.1.40.0350.00731.55
7.1.30.0630.00331.84
7.1.20.0530.01231.91
7.1.10.0150.00413.76
7.1.00.0360.00013.77
7.0.310.0440.00013.32
7.0.300.0250.00313.57
7.0.290.0600.00413.39
7.0.280.0110.00713.55
7.0.270.0110.00313.66
7.0.260.0390.00313.56
7.0.250.0310.00513.45
7.0.240.0330.00713.52
7.0.230.0220.01013.41
7.0.220.0470.00313.45
7.0.210.0420.00613.75
7.0.200.0330.00713.64
7.0.190.0290.01313.19
7.0.180.0310.01213.36
7.0.170.0430.00713.57
7.0.160.0140.00513.57
7.0.150.0100.00313.42
7.0.140.0160.00313.55
7.0.130.0470.00013.35
7.0.120.0250.00613.29
7.0.110.0360.00613.38
7.0.100.0400.00313.65
7.0.90.0140.00513.57
7.0.80.0090.00413.59
7.0.70.0540.00613.45
7.0.60.0440.00713.42
7.0.50.0280.00913.52
7.0.40.0220.01213.60
7.0.30.0720.00713.39
7.0.20.0070.00713.44
7.0.10.0380.01013.34
7.0.00.0330.00713.48

preferences:
49.44 ms | 401 KiB | 5 Q