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-CND1","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEiLCJkZiI6IjJmOTExZjdkOTgyZDQzMDY4YTNmYjc2MWRlZWQzZjI1In0=","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":"CPF","number":"000.000.001-91"},"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.70.0130.00716.63
8.3.60.0120.00916.61
8.3.50.0110.00616.62
8.3.40.0100.01018.75
8.3.30.0070.00719.02
8.3.20.0040.00420.21
8.3.10.0040.00423.70
8.3.00.0050.00319.66
8.2.180.0110.00718.66
8.2.170.0030.01722.96
8.2.160.0070.01018.91
8.2.150.0110.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00419.44
8.2.120.0040.00426.35
8.2.110.0060.00322.25
8.2.100.0040.00818.03
8.2.90.0050.00319.26
8.2.80.0040.00417.97
8.2.70.0040.00417.48
8.2.60.0090.00018.16
8.2.50.0060.00318.10
8.2.40.0040.00420.40
8.2.30.0050.00321.04
8.2.20.0070.00018.07
8.2.10.0000.00718.13
8.2.00.0040.00417.98
8.1.280.0170.00325.92
8.1.270.0050.00223.97
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00323.92
8.1.230.0040.00723.91
8.1.220.0000.00817.79
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0040.00417.38
8.1.180.0050.00318.10
8.1.170.0040.00418.40
8.1.160.0040.00419.00
8.1.150.0070.00020.53
8.1.140.0040.00419.55
8.1.130.0070.00018.83
8.1.120.0070.00017.39
8.1.110.0000.00717.42
8.1.100.0040.00417.50
8.1.90.0000.00717.52
8.1.80.0030.00517.50
8.1.70.0030.00317.38
8.1.60.0040.00417.64
8.1.50.0030.00617.55
8.1.40.0000.00917.52
8.1.30.0030.00617.63
8.1.20.0040.00417.71
8.1.10.0090.00317.57
8.1.00.0030.00517.52
8.0.300.0070.00018.77
8.0.290.0080.00016.75
8.0.280.0040.00418.49
8.0.270.0000.00817.34
8.0.260.0000.00716.84
8.0.250.0030.00316.98
8.0.240.0000.00716.99
8.0.230.0040.00416.88
8.0.220.0040.00416.90
8.0.210.0050.00216.77
8.0.200.0030.00616.96
8.0.190.0050.00316.93
8.0.180.0030.00516.88
8.0.170.0050.00316.92
8.0.160.0000.00816.94
8.0.150.0040.00416.87
8.0.140.0000.00816.87
8.0.130.0030.00313.34
8.0.120.0040.00416.86
8.0.110.0060.00316.89
8.0.100.0040.00416.94
8.0.90.0000.00716.95
8.0.80.0140.00416.91
8.0.70.0050.00216.93
8.0.60.0080.00016.76
8.0.50.0040.00416.88
8.0.30.0130.00617.09
8.0.20.0130.00617.40
8.0.10.0070.00016.85
8.0.00.0100.00716.83
7.4.330.0020.00215.55
7.4.320.0060.00016.58
7.4.300.0070.00016.59
7.4.290.0000.00716.54
7.4.280.0000.00816.57
7.4.270.0070.00016.63
7.4.260.0030.00316.55
7.4.250.0000.00716.57
7.4.240.0030.00616.52
7.4.230.0000.00716.61
7.4.220.0100.01416.48
7.4.210.0090.00616.54
7.4.200.0040.00316.50
7.4.160.0100.00616.59
7.4.150.0030.01517.40
7.4.140.0100.00917.86
7.4.130.0120.01216.43
7.4.120.0040.01716.48
7.4.110.0120.01216.38
7.4.100.0080.00916.68
7.4.90.0000.01616.57
7.4.80.0110.01119.39
7.4.70.0060.00916.35
7.4.60.0070.01016.69
7.4.50.0030.00916.45
7.4.40.0100.01316.68
7.4.30.0030.01316.56
7.4.00.0000.01414.84
7.3.330.0050.00013.10
7.3.320.0000.00613.28
7.3.310.0000.00716.14
7.3.300.0060.00016.25
7.3.290.0080.00816.34
7.3.280.0100.00816.28
7.3.270.0090.00917.40
7.3.260.0110.00716.36
7.3.250.0110.00816.32
7.3.240.0120.00616.37
7.3.230.0110.00816.40
7.3.210.0060.01116.30
7.3.200.0070.01016.68
7.3.190.0130.00316.34
7.3.180.0050.01016.52
7.3.170.0100.00716.57
7.3.160.0080.00816.34
7.2.330.0050.01316.46
7.2.320.0040.01216.78
7.2.310.0120.00616.46
7.2.300.0060.00916.74
7.2.290.0100.00716.81
7.2.90.1350.01614.85
7.2.80.0960.00615.04
7.2.70.0660.01314.73
7.2.60.1060.01014.95
7.2.50.0790.01015.19
7.2.40.0660.01015.16
7.2.30.0680.00715.25
7.2.20.1420.01014.91
7.2.10.1310.00015.19
7.2.00.1330.00615.30
7.1.210.1000.00313.62
7.1.200.1020.00913.85
7.1.190.0640.01013.94
7.1.180.0840.00613.73
7.1.170.0790.00613.90
7.1.160.0680.01213.77
7.1.150.0750.00713.63
7.1.140.1480.01013.79
7.1.130.1240.00313.87
7.1.120.1020.01013.88
7.1.110.1040.00313.98
7.1.100.0150.01013.85
7.1.90.0110.01613.88
7.1.80.0810.00713.69
7.1.70.0120.00913.75
7.1.60.1520.00731.90
7.1.50.0840.01231.63
7.1.40.0420.00331.93
7.1.30.0840.01631.85
7.1.20.0310.00731.96
7.1.10.0230.00813.61
7.1.00.0200.00813.91
7.0.310.0670.00613.45
7.0.300.0630.00713.59
7.0.290.0720.00313.02
7.0.280.0940.00313.63
7.0.270.1300.01313.11
7.0.260.1250.00713.42
7.0.250.1300.00913.58
7.0.240.0590.00313.66
7.0.230.0130.01213.60
7.0.220.0210.00013.31
7.0.210.0900.00613.12
7.0.200.0120.01013.17
7.0.190.0100.00813.42
7.0.180.0150.00513.37
7.0.170.0900.00513.68
7.0.160.0150.00613.41
7.0.150.0220.00613.50
7.0.140.0580.00713.17
7.0.130.0120.00813.45
7.0.120.0100.01013.29
7.0.110.0340.00013.32
7.0.100.0410.00313.37
7.0.90.0080.01313.39
7.0.80.0480.01213.23
7.0.70.0180.00613.10
7.0.60.0110.00513.15
7.0.50.0050.01513.71
7.0.40.0860.01413.24
7.0.30.1130.00913.39
7.0.20.0160.00013.57
7.0.10.1010.01313.37
7.0.00.1110.00713.61

preferences:
42.72 ms | 401 KiB | 5 Q