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-CND11","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEiLCJkZiI6IjJmOTExZjdkOTgyZDQzMDY4YTNmYjc2MWRlZWQzZjI1In0=","notify-url":"https://virtual-store.com/notifications/","test-mode": 0,"payment-group":"credit_card","country":"BR","language":"cebolas"},"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.0080.01118.68
8.3.50.0110.00416.88
8.3.40.0070.00718.96
8.3.30.0120.00318.69
8.3.20.0000.00820.34
8.3.10.0050.00323.58
8.3.00.0050.00319.81
8.2.180.0200.00318.55
8.2.170.0030.01022.96
8.2.160.0090.00919.04
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0000.00819.44
8.2.120.0050.00326.35
8.2.110.0070.00320.58
8.2.100.0060.00617.88
8.2.90.0040.00419.22
8.2.80.0000.00818.16
8.2.70.0090.00017.63
8.2.60.0050.00317.93
8.2.50.0030.00618.10
8.2.40.0040.00420.50
8.2.30.0050.00319.26
8.2.20.0040.00418.00
8.2.10.0040.00418.13
8.2.00.0040.00418.14
8.1.280.0070.00725.92
8.1.270.0000.00722.14
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0100.00021.03
8.1.230.0060.00619.15
8.1.220.0050.00317.76
8.1.210.0080.00018.77
8.1.200.0000.01017.35
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0040.00718.44
8.1.160.0030.00318.95
8.1.150.0070.00018.89
8.1.140.0040.00419.65
8.1.130.0000.00818.82
8.1.120.0050.00217.51
8.1.110.0030.00517.43
8.1.100.0000.00817.52
8.1.90.0020.00517.51
8.1.80.0050.00317.48
8.1.70.0070.00017.38
8.1.60.0060.00317.62
8.1.50.0040.00417.54
8.1.40.0030.00617.59
8.1.30.0080.00017.66
8.1.20.0050.00317.63
8.1.10.0040.00417.52
8.1.00.0000.00817.54
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0030.00318.46
8.0.270.0070.00017.23
8.0.260.0030.00316.85
8.0.250.0000.00717.01
8.0.240.0080.00016.93
8.0.230.0070.00017.07
8.0.220.0030.00316.82
8.0.210.0040.00416.88
8.0.200.0040.00416.95
8.0.190.0040.00416.85
8.0.180.0040.00416.97
8.0.170.0030.00416.91
8.0.160.0040.00416.83
8.0.150.0070.00016.89
8.0.140.0040.00416.91
8.0.130.0060.00013.30
8.0.120.0040.00416.83
8.0.110.0070.00016.78
8.0.100.0040.00416.73
8.0.90.0080.00016.95
8.0.80.0040.01216.94
8.0.70.0040.00416.79
8.0.60.0080.00017.02
8.0.50.0000.00716.88
8.0.30.0100.00817.09
8.0.20.0070.01317.40
8.0.10.0000.00716.82
8.0.00.0080.00816.69
7.4.330.0050.00015.55
7.4.320.0030.00316.52
7.4.300.0030.00316.50
7.4.290.0030.00716.53
7.4.280.0000.00816.53
7.4.270.0030.00316.54
7.4.260.0000.00513.25
7.4.250.0050.00316.57
7.4.240.0000.00716.69
7.4.230.0030.00316.73
7.4.220.0100.01416.54
7.4.210.0060.01616.55
7.4.200.0070.00016.72
7.4.160.0090.00716.59
7.4.150.0120.00617.40
7.4.140.0080.00917.86
7.4.130.0130.00616.50
7.4.120.0130.00416.55
7.4.110.0090.00916.71
7.4.100.0140.00316.60
7.4.90.0100.00716.53
7.4.80.0140.00919.39
7.4.70.0080.00816.53
7.4.60.0080.00816.36
7.4.50.0030.00916.52
7.4.40.0000.01616.48
7.4.30.0130.00316.57
7.4.00.0000.01414.85
7.3.330.0000.00613.17
7.3.320.0000.00513.30
7.3.310.0030.00316.30
7.3.300.0030.00316.21
7.3.290.0060.00816.36
7.3.280.0070.01016.31
7.3.270.0060.01217.40
7.3.260.0070.01116.50
7.3.250.0110.00516.43
7.3.240.0070.01016.41
7.3.230.0030.01316.61
7.3.210.0060.01016.59
7.3.200.0110.00716.57
7.3.190.0100.00616.59
7.3.180.0060.00916.39
7.3.170.0220.00016.58
7.3.160.0100.01116.36
7.3.10.0060.00916.65
7.3.00.0000.01416.55
7.2.330.0090.00916.45
7.2.320.0100.00716.80
7.2.310.0120.00616.71
7.2.300.0140.00316.77
7.2.290.0070.01016.84
7.2.130.0040.01116.87
7.2.120.0060.00616.95
7.2.110.0120.00916.91
7.2.100.0140.00316.88
7.2.90.0090.00515.71
7.2.80.0330.00615.82
7.2.70.0710.00815.78
7.2.60.0380.00615.85
7.2.50.0270.00715.82
7.2.40.0350.00715.91
7.2.30.0300.00916.06
7.2.20.0270.00315.96
7.2.10.0370.00215.94
7.2.00.0250.00515.88
7.1.250.0070.00315.48
7.1.210.0170.00714.07
7.1.200.0300.00414.05
7.1.190.0610.01313.54
7.1.180.1330.00913.82
7.1.170.0680.00713.74
7.1.160.0690.01213.98
7.1.150.0270.00313.80
7.1.140.0310.01213.93
7.1.130.0480.00313.56
7.1.120.0730.00313.86
7.1.110.1090.00413.90
7.1.100.0410.00913.90
7.1.90.0430.01313.89
7.1.80.1020.00413.67
7.1.70.0150.00514.07
7.1.60.0300.00931.85
7.1.50.1000.01032.11
7.1.40.0310.01731.60
7.1.30.0500.00431.77
7.1.20.0210.01731.90
7.1.10.0500.00614.06
7.1.00.0560.00413.89
7.0.310.0270.00813.55
7.0.300.0470.01313.69
7.0.290.0960.00313.23
7.0.280.0900.00713.52
7.0.270.0440.00613.69
7.0.260.0750.00913.63
7.0.250.0620.01013.28
7.0.240.0720.00313.17
7.0.230.0430.00613.50
7.0.220.0560.01513.11
7.0.210.0100.01013.55
7.0.200.0210.00413.54
7.0.190.0110.00813.58
7.0.180.0170.00713.14
7.0.170.0410.00013.34
7.0.160.0530.00013.73
7.0.150.0550.01013.66
7.0.140.0490.01013.33
7.0.130.0600.01313.50
7.0.120.0810.00313.41
7.0.110.0110.00713.57
7.0.100.0440.00813.62
7.0.90.0370.00813.65
7.0.80.0620.00613.62
7.0.70.0400.01013.41
7.0.60.0640.01313.50
7.0.50.0450.00313.54
7.0.40.0340.00613.55
7.0.30.0700.00613.58
7.0.20.0570.00713.72
7.0.10.0690.00313.24
7.0.00.0290.00313.43

preferences:
39.54 ms | 400 KiB | 5 Q