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-CND9","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEiLCJkZiI6IjJmOTExZjdkOTgyZDQzMDY4YTNmYjc2MWRlZWQzZjI1In0=","notify-url":"https://virtual-store.com/notifications/","test-mode": 0,"payment-group":"credit_card","country":"BR","language":"pt-BR"},"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.0070.00718.43
8.3.50.0070.01116.65
8.3.40.0040.01118.81
8.3.30.0150.00018.87
8.3.20.0080.00020.31
8.3.10.0050.00323.45
8.3.00.0080.00019.69
8.2.180.0110.00418.66
8.2.170.0120.00322.96
8.2.160.0090.00919.21
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0000.00819.32
8.2.120.0050.00226.35
8.2.110.0060.00320.29
8.2.100.0040.00818.03
8.2.90.0040.00419.17
8.2.80.0030.00517.97
8.2.70.0040.00417.50
8.2.60.0080.00018.05
8.2.50.0030.00618.10
8.2.40.0040.00420.59
8.2.30.0050.00219.33
8.2.20.0000.00717.99
8.2.10.0000.00717.96
8.2.00.0000.00718.06
8.1.280.0140.00025.92
8.1.270.0080.00022.24
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00320.86
8.1.230.0000.01119.16
8.1.220.0070.00317.74
8.1.210.0080.00018.77
8.1.200.0060.00317.48
8.1.190.0050.00317.48
8.1.180.0040.00418.10
8.1.170.0030.00718.42
8.1.160.0070.00019.10
8.1.150.0000.00820.58
8.1.140.0040.00419.61
8.1.130.0000.00718.96
8.1.120.0040.00417.45
8.1.110.0090.00017.47
8.1.100.0000.00817.42
8.1.90.0040.00417.48
8.1.80.0050.00217.49
8.1.70.0040.00417.48
8.1.60.0030.00517.59
8.1.50.0040.00417.42
8.1.40.0030.00617.55
8.1.30.0000.00817.62
8.1.20.0030.00617.61
8.1.10.0000.00817.49
8.1.00.0000.00817.55
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.48
8.0.270.0030.00317.29
8.0.260.0070.00016.73
8.0.250.0030.00316.87
8.0.240.0050.00316.99
8.0.230.0040.00416.85
8.0.220.0000.00716.82
8.0.210.0050.00316.91
8.0.200.0000.00717.00
8.0.190.0050.00316.83
8.0.180.0030.00616.94
8.0.170.0000.00716.84
8.0.160.0000.00716.82
8.0.150.0000.00716.84
8.0.140.0000.00716.82
8.0.130.0030.00313.34
8.0.120.0000.00716.80
8.0.110.0040.00416.69
8.0.100.0050.00216.80
8.0.90.0000.00817.03
8.0.80.0180.00316.83
8.0.70.0030.00516.84
8.0.60.0000.00716.80
8.0.50.0040.00416.80
8.0.30.0150.00917.11
8.0.20.0100.00917.40
8.0.10.0000.00816.95
8.0.00.0060.01116.62
7.4.330.0000.00515.55
7.4.320.0030.00316.60
7.4.300.0030.00316.61
7.4.290.0090.00316.57
7.4.280.0040.00416.51
7.4.270.0040.00416.51
7.4.260.0000.00513.34
7.4.250.0030.00516.57
7.4.240.0080.00016.55
7.4.230.0050.00216.60
7.4.220.0140.00316.51
7.4.210.0040.01916.45
7.4.200.0030.00316.36
7.4.160.0100.01016.46
7.4.150.0110.00617.40
7.4.140.0080.00917.86
7.4.130.0060.01316.49
7.4.120.0120.01016.50
7.4.110.0080.00816.47
7.4.100.0130.00516.64
7.4.90.0060.01016.39
7.4.80.0040.01319.39
7.4.70.0080.00816.50
7.4.60.0070.01116.51
7.4.50.0070.00716.50
7.4.40.0150.00716.69
7.4.30.0110.00616.61
7.4.00.0100.00714.93
7.3.330.0000.00513.25
7.3.320.0050.00013.19
7.3.310.0070.00016.31
7.3.300.0000.00716.21
7.3.290.0090.00916.30
7.3.280.0080.01016.31
7.3.270.0170.00717.40
7.3.260.0140.00616.37
7.3.250.0090.00916.42
7.3.240.0130.00516.37
7.3.230.0070.01016.57
7.3.210.0080.01216.20
7.3.200.0110.00616.35
7.3.190.0050.01016.40
7.3.180.0030.01316.62
7.3.170.0090.00616.21
7.3.160.0100.00616.27
7.3.10.0070.00316.63
7.3.00.0040.00816.52
7.2.330.0100.00716.81
7.2.320.0080.01416.86
7.2.310.0190.00316.45
7.2.300.0150.00616.82
7.2.290.0040.01216.72
7.2.130.0100.01016.84
7.2.120.0030.01317.09
7.2.110.0030.01016.89
7.2.100.0030.00916.99
7.2.90.0190.00615.81
7.2.80.0260.00815.95
7.2.70.0500.00916.01
7.2.60.0110.00515.88
7.2.50.0660.00915.89
7.2.40.0530.01015.95
7.2.30.0690.01016.00
7.2.20.0130.00715.97
7.2.10.0970.00716.09
7.2.00.0670.01116.03
7.1.250.0030.00715.91
7.1.210.1380.00713.98
7.1.200.0120.00613.98
7.1.190.1360.00914.05
7.1.180.0440.00413.80
7.1.170.0060.01313.59
7.1.160.0340.01013.72
7.1.150.0130.00914.07
7.1.140.0040.01313.70
7.1.130.2180.01013.95
7.1.120.1750.01013.76
7.1.110.2010.00314.04
7.1.100.1410.01013.93
7.1.90.1660.00613.64
7.1.80.1370.00713.89
7.1.70.1590.00313.64
7.1.60.1570.01031.67
7.1.50.2350.01731.91
7.1.40.2670.01031.88
7.1.30.1550.01331.69
7.1.20.2280.01331.84
7.1.10.1270.00714.01
7.1.00.2170.01013.97
7.0.310.2280.00713.79
7.0.300.0100.01013.48
7.0.290.0900.01213.29
7.0.280.0250.00313.69
7.0.270.1550.00313.32
7.0.260.2750.00313.59
7.0.250.1610.00713.34
7.0.240.2240.00713.54
7.0.230.1490.00713.63
7.0.220.1540.00313.30
7.0.210.1920.00713.46
7.0.200.2370.00313.67
7.0.190.1130.00713.44
7.0.180.1240.00313.61
7.0.170.1390.01313.54
7.0.160.1640.00713.62
7.0.150.1840.00313.58
7.0.140.2510.01213.58
7.0.130.1360.01013.50
7.0.120.1040.00313.50
7.0.110.2320.01313.24
7.0.100.1570.01013.43
7.0.90.1370.01313.36
7.0.80.0400.00613.10
7.0.70.1240.00313.37
7.0.60.1090.00713.52
7.0.50.0900.00613.43
7.0.40.0970.00613.63
7.0.30.1050.00013.53
7.0.20.1000.01013.18
7.0.10.1440.01013.25
7.0.00.1300.00713.19

preferences:
43.31 ms | 401 KiB | 5 Q