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-CND","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.60.0130.00616.88
8.3.50.0120.00316.60
8.3.40.0040.01119.00
8.3.30.0070.00718.79
8.3.20.0040.00420.34
8.3.10.0000.00823.65
8.3.00.0040.00419.56
8.2.180.0130.01016.75
8.2.170.0000.01522.96
8.2.160.0070.00719.07
8.2.150.0050.00524.18
8.2.140.0030.00524.66
8.2.130.0090.00019.21
8.2.120.0040.00426.35
8.2.110.0060.00320.16
8.2.100.0060.00617.97
8.2.90.0050.00319.30
8.2.80.0000.00818.05
8.2.70.0040.00417.38
8.2.60.0060.00317.93
8.2.50.0000.00918.10
8.2.40.0050.00220.61
8.2.30.0040.00421.02
8.2.20.0040.00417.99
8.2.10.0000.00818.02
8.2.00.0070.00018.06
8.1.280.0110.00725.92
8.1.270.0060.00323.73
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00021.95
8.1.230.0040.00819.13
8.1.220.0000.00817.79
8.1.210.0000.00918.77
8.1.200.0030.00617.35
8.1.190.0000.00817.36
8.1.180.0040.00418.10
8.1.170.0000.00818.51
8.1.160.0030.00319.04
8.1.150.0050.00318.85
8.1.140.0030.00719.55
8.1.130.0040.00418.91
8.1.120.0030.00517.39
8.1.110.0050.00217.47
8.1.100.0040.00417.38
8.1.90.0030.00517.39
8.1.80.0040.00417.46
8.1.70.0030.00317.39
8.1.60.0040.00417.49
8.1.50.0040.00417.50
8.1.40.0030.00617.41
8.1.30.0000.00817.61
8.1.20.0050.00317.66
8.1.10.0110.00017.49
8.1.00.0040.00417.58
8.0.300.0050.00319.75
8.0.290.0040.00416.72
8.0.280.0050.00218.50
8.0.270.0070.00017.15
8.0.260.0030.00316.89
8.0.250.0070.00016.95
8.0.240.0040.00416.91
8.0.230.0070.00016.92
8.0.220.0040.00416.81
8.0.210.0030.00316.80
8.0.200.0000.00616.93
8.0.190.0080.00016.95
8.0.180.0030.00516.95
8.0.170.0040.00416.89
8.0.160.0000.00716.86
8.0.150.0070.00016.75
8.0.140.0070.00016.75
8.0.130.0050.00013.28
8.0.120.0030.00616.85
8.0.110.0040.00416.89
8.0.100.0000.00716.91
8.0.90.0050.00316.82
8.0.80.0060.01316.97
8.0.70.0040.00416.94
8.0.60.0000.00716.87
8.0.50.0020.00516.97
8.0.30.0120.00617.20
8.0.20.0090.00917.40
8.0.10.0020.00516.84
8.0.00.0090.00916.67
7.4.330.0030.00315.55
7.4.320.0000.00616.63
7.4.300.0030.00316.52
7.4.290.0050.00316.53
7.4.280.0080.00016.63
7.4.270.0070.00016.43
7.4.260.0070.00016.62
7.4.250.0050.00216.58
7.4.240.0000.00716.48
7.4.230.0000.00716.45
7.4.220.0090.00916.48
7.4.210.0060.00916.65
7.4.200.0000.00716.61
7.4.160.0090.00816.54
7.4.150.0150.01217.40
7.4.140.0100.00817.86
7.4.130.0110.00716.68
7.4.120.0120.00816.60
7.4.110.0090.01516.58
7.4.100.0070.01016.70
7.4.90.0100.01016.61
7.4.80.0090.01219.39
7.4.70.0080.00816.52
7.4.60.0120.00416.60
7.4.50.0090.00916.46
7.4.40.0100.01316.49
7.4.30.0060.01216.41
7.4.00.0060.00615.04
7.3.330.0000.00613.19
7.3.320.0000.00513.10
7.3.310.0030.00316.18
7.3.300.0070.00016.33
7.3.290.0110.00516.32
7.3.280.0080.00716.33
7.3.270.0140.00417.40
7.3.260.0130.00916.46
7.3.250.0070.00916.44
7.3.240.0090.01116.48
7.3.230.0070.01116.62
7.3.210.0070.01716.38
7.3.200.0170.00016.36
7.3.190.0100.00716.32
7.3.180.0140.00716.27
7.3.170.0070.01016.37
7.3.160.0080.00816.56
7.2.330.0110.00616.89
7.2.320.0140.00316.50
7.2.310.0130.01016.87
7.2.300.0150.00616.78
7.2.290.0170.00016.69
7.2.60.0690.00815.30
7.2.00.0060.00919.44
7.1.200.0110.00415.73
7.1.100.0070.00317.84
7.1.70.0060.00817.02
7.1.60.0330.01734.84
7.1.50.0290.02034.72
7.1.40.0280.00734.50
7.1.30.0270.02034.32
7.1.20.0220.02634.47
7.1.10.0050.01316.46
7.1.00.0000.01516.58
7.0.200.0070.01516.56
7.0.190.0080.00816.48
7.0.180.0030.01316.18
7.0.170.0120.00916.20
7.0.160.0080.00916.52
7.0.150.0090.01316.25
7.0.140.0070.01116.38
7.0.130.0030.01216.54
7.0.120.0090.00916.66
7.0.110.0030.01316.28
7.0.100.0030.01516.54
7.0.90.0030.01316.27
7.0.80.0070.01116.60
7.0.70.0000.01716.22
7.0.60.0070.01415.91
7.0.50.0080.00816.31
7.0.40.0030.01316.54
7.0.30.0060.01216.41
7.0.20.0110.00916.37
7.0.10.0060.00916.29
7.0.00.0040.01116.48

preferences:
49.96 ms | 401 KiB | 5 Q