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":"en-US"},"payer":{"email":"payer@uolinc.com","phone-area-code":"11","phone-number":"988881234","document":{"type":"CPF","number":"00000000191"}}}'; $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.0110.00718.55
8.3.50.0140.00316.45
8.3.40.0120.00318.96
8.3.30.0040.01118.86
8.3.20.0080.00020.42
8.3.10.0040.00423.65
8.3.00.0040.00419.56
8.2.180.0080.00818.29
8.2.170.0070.00722.96
8.2.160.0040.01119.16
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0080.00019.22
8.2.120.0050.00226.35
8.2.110.0050.00520.38
8.2.100.0120.00017.97
8.2.90.0080.00019.36
8.2.80.0000.00818.05
8.2.70.0060.00317.50
8.2.60.0070.00318.05
8.2.50.0030.00618.10
8.2.40.0040.00420.59
8.2.30.0040.00419.23
8.2.20.0050.00317.96
8.2.10.0000.00717.95
8.2.00.0040.00418.04
8.1.280.0110.00425.92
8.1.270.0080.00023.79
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.68
8.1.230.0040.00818.95
8.1.220.0070.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0080.00418.42
8.1.160.0030.00318.94
8.1.150.0040.00420.59
8.1.140.0040.00419.50
8.1.130.0030.00318.90
8.1.120.0040.00417.56
8.1.110.0040.00417.48
8.1.100.0030.00517.36
8.1.90.0070.00017.49
8.1.80.0000.00717.52
8.1.70.0050.00217.51
8.1.60.0000.00917.66
8.1.50.0040.00417.52
8.1.40.0050.00317.53
8.1.30.0040.00417.59
8.1.20.0040.00417.57
8.1.10.0050.00317.64
8.1.00.0000.00717.50
8.0.300.0000.00718.77
8.0.290.0050.00316.75
8.0.280.0070.00018.47
8.0.270.0070.00017.34
8.0.260.0040.00416.86
8.0.250.0000.00816.97
8.0.240.0000.00716.96
8.0.230.0000.00716.95
8.0.220.0070.00016.90
8.0.210.0000.00716.91
8.0.200.0000.00716.86
8.0.190.0060.00316.98
8.0.180.0040.00416.90
8.0.170.0070.00016.95
8.0.160.0080.00016.81
8.0.150.0000.00716.81
8.0.140.0050.00216.89
8.0.130.0000.00713.33
8.0.120.0040.00416.75
8.0.110.0000.00816.94
8.0.100.0040.00416.86
8.0.90.0030.00416.93
8.0.80.0060.01516.87
8.0.70.0080.00016.77
8.0.60.0000.00716.78
8.0.50.0000.00716.80
8.0.30.0130.01817.11
8.0.20.0110.01617.40
8.0.10.0000.00816.82
8.0.00.0090.01216.71
7.4.330.0000.00615.55
7.4.320.0000.00616.60
7.4.300.0000.00716.63
7.4.290.0070.00316.54
7.4.280.0090.00016.53
7.4.270.0040.00416.68
7.4.260.0060.00316.61
7.4.250.0030.00716.49
7.4.240.0050.00316.59
7.4.230.0000.00716.73
7.4.220.0030.01616.73
7.4.210.0070.01116.64
7.4.200.0080.00016.63
7.4.160.0090.00916.54
7.4.150.0230.03617.40
7.4.140.0070.01117.86
7.4.130.0110.01116.50
7.4.120.0140.00816.60
7.4.110.0100.00716.62
7.4.100.0080.01116.54
7.4.90.0100.01016.48
7.4.80.0110.00619.39
7.4.70.0070.01016.63
7.4.60.0090.00616.55
7.4.50.0070.00516.40
7.4.40.0060.01016.49
7.4.30.0090.00916.49
7.4.00.0070.00715.07
7.3.330.0060.00013.29
7.3.320.0050.00013.19
7.3.310.0040.00416.17
7.3.300.0030.00316.20
7.3.290.0100.00716.34
7.3.280.0070.00916.32
7.3.270.0190.02317.40
7.3.260.0070.01016.38
7.3.250.0110.00816.45
7.3.240.0080.01216.32
7.3.230.0100.00616.37
7.3.210.0090.00916.39
7.3.200.0130.00316.16
7.3.190.0110.00516.45
7.3.180.0140.00716.37
7.3.170.0120.00316.38
7.3.160.0090.00616.27
7.3.120.0090.01014.66
7.3.110.0030.01414.78
7.3.100.0030.01414.57
7.3.90.0030.01314.85
7.3.80.0000.01614.60
7.3.70.0130.00614.98
7.3.60.0050.00514.86
7.3.50.0080.00414.77
7.3.40.0060.00615.02
7.3.30.0090.00315.00
7.3.20.0030.01016.67
7.3.10.0090.01016.27
7.3.00.0130.01016.60
7.2.330.0110.01116.86
7.2.320.0110.00716.79
7.2.310.0180.00316.43
7.2.300.0030.01616.84
7.2.290.0060.01216.72
7.2.240.0060.01315.24
7.2.230.0000.01314.93
7.2.220.0120.00314.79
7.2.210.0030.01415.27
7.2.200.0060.00615.22
7.2.190.0090.00915.06
7.2.180.0000.01815.22
7.2.170.0030.01314.93
7.2.160.0090.00615.03
7.2.150.0030.01016.91
7.2.140.0070.01016.66
7.2.130.0100.00716.69
7.2.120.0070.01016.81
7.2.110.0090.01016.77
7.2.100.0150.00616.88
7.2.90.0410.00816.03
7.2.80.0120.00816.27
7.2.70.0130.00916.11
7.2.60.0100.01116.07
7.2.50.0080.01116.15
7.2.40.0070.00716.12
7.2.30.0120.00516.27
7.2.20.0530.00816.11
7.2.10.0180.00516.10
7.2.00.0120.00516.23
7.1.330.0040.01415.50
7.1.320.0090.00915.89
7.1.310.0130.00615.85
7.1.300.0060.00615.81
7.1.290.0080.00615.71
7.1.280.0110.00715.72
7.1.270.0030.01215.68
7.1.260.0070.00315.72
7.1.250.0110.00915.75
7.1.210.0080.00813.80
7.1.200.0410.00913.50
7.1.190.0280.00313.60
7.1.180.0040.01313.72
7.1.170.0320.01013.64
7.1.160.0090.00913.48
7.1.150.0040.00813.77
7.1.140.0660.00613.73
7.1.130.0000.01413.73
7.1.120.0090.00613.65
7.1.110.0130.00313.71
7.1.100.1610.00013.70
7.1.90.0060.01213.86
7.1.80.0740.00713.85
7.1.70.2040.00713.76
7.1.60.1320.00731.56
7.1.50.0280.00731.73
7.1.40.1130.00731.90
7.1.30.0330.00731.75
7.1.20.1070.01331.80
7.1.10.0140.00013.48
7.1.00.0550.01013.84
7.0.310.0490.01113.39
7.0.300.0770.00413.39
7.0.290.0630.00913.59
7.0.280.0120.00613.63
7.0.270.0600.00613.45
7.0.260.0140.00913.55
7.0.250.0120.00913.60
7.0.240.2100.00013.71
7.0.230.1490.01013.75
7.0.220.0150.00913.44
7.0.210.0860.01313.80
7.0.200.0120.00913.50
7.0.190.0940.01013.41
7.0.180.0750.00313.34
7.0.170.0100.01413.72
7.0.160.0900.00313.59
7.0.150.0490.00713.47
7.0.140.0720.00313.75
7.0.130.0620.00613.59
7.0.120.0940.01313.68
7.0.110.0660.00013.77
7.0.100.0610.01013.71
7.0.90.1140.00313.45
7.0.80.0930.00613.63
7.0.70.0220.00013.62
7.0.60.0540.01113.69
7.0.50.0200.00313.72
7.0.40.1360.00013.57
7.0.30.0230.00413.52
7.0.20.0930.00013.73
7.0.10.0620.01113.38
7.0.00.1270.01313.69

preferences:
37.29 ms | 401 KiB | 5 Q