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-CND7","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEiLCJkZiI6IjJmOTExZjdkOTgyZDQzMDY4YTNmYjc2MWRlZWQzZjI1In0=","notify-url":"https://virtual-store.com/notifications/","test-mode": 0,"payment-group":"credit_card","country":"BR","language":"en-US"},"payer":{"name":"João Pagão","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.0120.00618.68
8.3.50.0150.00016.64
8.3.40.0150.00018.71
8.3.30.0090.00618.98
8.3.20.0060.00320.33
8.3.10.0040.00423.48
8.3.00.0030.00519.78
8.2.180.0110.01118.54
8.2.170.0040.01122.96
8.2.160.0070.00719.21
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00519.31
8.2.120.0100.00326.35
8.2.110.0030.00720.45
8.2.100.0090.00317.97
8.2.90.0040.00419.36
8.2.80.0000.00718.03
8.2.70.0040.00417.63
8.2.60.0040.00418.05
8.2.50.0030.00618.16
8.2.40.0040.00420.34
8.2.30.0050.00319.27
8.2.20.0000.00818.14
8.2.10.0000.00918.02
8.2.00.0030.00518.18
8.1.280.0070.00725.92
8.1.270.0040.00422.14
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0060.00320.88
8.1.230.0070.00418.97
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0050.00517.13
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0040.00718.50
8.1.160.0040.00419.04
8.1.150.0050.00320.67
8.1.140.0030.00619.51
8.1.130.0030.00518.95
8.1.120.0040.00417.47
8.1.110.0030.00517.41
8.1.100.0080.00017.36
8.1.90.0000.00717.55
8.1.80.0000.00717.52
8.1.70.0020.00517.37
8.1.60.0030.00617.62
8.1.50.0040.00417.57
8.1.40.0040.00417.39
8.1.30.0000.00817.63
8.1.20.0000.00817.66
8.1.10.0000.00817.53
8.1.00.0070.00017.54
8.0.300.0000.00818.77
8.0.290.0070.00016.75
8.0.280.0000.00818.36
8.0.270.0030.00317.29
8.0.260.0030.00316.75
8.0.250.0000.00717.02
8.0.240.0000.00717.02
8.0.230.0070.00016.93
8.0.220.0030.00316.81
8.0.210.0030.00316.80
8.0.200.0000.00716.99
8.0.190.0000.00916.86
8.0.180.0040.00416.94
8.0.170.0000.00816.90
8.0.160.0000.00716.92
8.0.150.0040.00416.85
8.0.140.0030.00616.88
8.0.130.0030.00313.30
8.0.120.0060.00316.91
8.0.110.0040.00416.79
8.0.100.0040.00416.80
8.0.90.0040.00416.76
8.0.80.0000.01516.96
8.0.70.0040.00416.96
8.0.60.0040.00416.89
8.0.50.0000.00716.75
8.0.30.0090.00917.05
8.0.20.0110.00717.40
8.0.10.0040.00416.96
8.0.00.0120.00616.75
7.4.330.0000.00515.55
7.4.320.0030.00316.52
7.4.300.0000.00616.51
7.4.290.0070.00416.61
7.4.280.0000.00716.42
7.4.270.0000.00816.63
7.4.260.0030.00313.22
7.4.250.0000.00716.59
7.4.240.0030.00316.45
7.4.230.0000.00716.50
7.4.220.0120.00916.67
7.4.210.0060.00916.45
7.4.200.0000.00716.61
7.4.160.0040.01216.46
7.4.150.0210.00317.40
7.4.140.0100.00917.86
7.4.130.0090.00916.50
7.4.120.0110.00816.56
7.4.110.0070.01116.48
7.4.100.0120.00616.63
7.4.90.0060.01016.53
7.4.80.0080.00819.39
7.4.70.0060.01016.35
7.4.60.0080.00816.62
7.4.50.0130.00016.60
7.4.40.0060.00916.70
7.4.30.0080.00816.32
7.4.00.0120.00315.08
7.3.330.0050.00013.23
7.3.320.0050.00013.33
7.3.310.0000.00816.31
7.3.300.0040.00416.30
7.3.290.0070.00916.32
7.3.280.0100.00716.30
7.3.270.0100.01417.40
7.3.260.0070.01016.49
7.3.250.0120.00716.39
7.3.240.0040.01316.46
7.3.230.0050.01316.36
7.3.210.0110.00516.25
7.3.200.0000.01616.59
7.3.190.0060.01616.45
7.3.180.0090.01316.40
7.3.170.0080.00816.56
7.3.160.0130.00316.40
7.2.330.0140.01116.79
7.2.320.0070.01116.82
7.2.310.0080.01316.49
7.2.300.0070.01016.73
7.2.290.0110.00816.65
7.2.90.0890.00314.83
7.2.80.0000.01414.62
7.2.70.1400.00914.90
7.2.60.2200.00714.97
7.2.50.2530.00315.15
7.2.40.2480.00614.71
7.2.30.1590.01014.93
7.2.20.1150.00314.58
7.2.10.1160.01014.82
7.2.00.0090.00914.96
7.1.210.1050.00713.79
7.1.200.0080.00413.75
7.1.190.0110.00713.75
7.1.180.2580.01013.78
7.1.170.2000.00313.84
7.1.160.2240.00713.82
7.1.150.1330.00613.83
7.1.140.1080.00413.69
7.1.130.0060.00914.01
7.1.120.1030.00913.57
7.1.110.1160.01313.79
7.1.100.1280.01013.65
7.1.90.1070.00913.68
7.1.80.0540.00313.47
7.1.70.0260.01314.07
7.1.60.1730.01332.04
7.1.50.1030.00631.91
7.1.40.0910.00631.81
7.1.30.0290.01231.94
7.1.20.0870.01231.70
7.1.10.0120.00813.95
7.1.00.0740.01013.72
7.0.310.0580.00313.34
7.0.300.1930.00313.44
7.0.290.1390.00613.30
7.0.280.1760.00313.47
7.0.270.0080.00413.70
7.0.260.1400.00013.66
7.0.250.0930.01313.64
7.0.240.1280.00013.60
7.0.230.0110.00513.62
7.0.220.1440.00713.74
7.0.210.1610.00313.71
7.0.200.0870.00613.38
7.0.190.0090.00913.67
7.0.180.0110.01413.44
7.0.170.1080.00013.37
7.0.160.0300.00613.49
7.0.150.1420.01313.56
7.0.140.0060.01213.55
7.0.130.0150.00013.53
7.0.120.1020.00913.58
7.0.110.0740.00313.67
7.0.100.0790.01013.40
7.0.90.0820.00713.69
7.0.80.0950.00313.68
7.0.70.1080.00313.73
7.0.60.0890.00613.74
7.0.50.0730.01013.63
7.0.40.0800.01013.58
7.0.30.0870.00713.75
7.0.20.0950.01013.66
7.0.10.0880.00713.80
7.0.00.0990.00713.80

preferences:
47.93 ms | 401 KiB | 5 Q