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":"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.0120.00918.55
8.3.50.0090.00616.49
8.3.40.0070.01418.59
8.3.30.0070.00719.02
8.3.20.0070.00020.29
8.3.10.0080.00023.57
8.3.00.0000.00819.79
8.2.180.0150.00318.29
8.2.170.0120.00322.96
8.2.160.0060.00919.21
8.2.150.0050.00325.66
8.2.140.0030.00524.66
8.2.130.0050.00219.44
8.2.120.0040.00426.35
8.2.110.0090.00920.99
8.2.100.0070.00317.91
8.2.90.0000.00819.17
8.2.80.0000.00817.97
8.2.70.0030.00517.63
8.2.60.0050.00317.93
8.2.50.0040.00418.10
8.2.40.0030.00520.47
8.2.30.0000.00819.27
8.2.20.0080.00018.04
8.2.10.0040.00418.08
8.2.00.0040.00417.97
8.1.280.0100.00325.92
8.1.270.0040.00422.11
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0060.00323.98
8.1.230.0050.00517.76
8.1.220.0000.00917.76
8.1.210.0030.00618.77
8.1.200.0030.00617.47
8.1.190.0000.00917.35
8.1.180.0030.00518.10
8.1.170.0070.00318.50
8.1.160.0040.00418.91
8.1.150.0080.00020.68
8.1.140.0000.00719.50
8.1.130.0030.00318.91
8.1.120.0070.00017.42
8.1.110.0040.00417.38
8.1.100.0040.00417.38
8.1.90.0040.00417.49
8.1.80.0000.00717.50
8.1.70.0070.00017.49
8.1.60.0040.00417.63
8.1.50.0030.00517.51
8.1.40.0030.00617.50
8.1.30.0040.00417.57
8.1.20.0030.00617.72
8.1.10.0040.00417.57
8.1.00.0040.00417.46
8.0.300.0050.00318.77
8.0.290.0070.00016.75
8.0.280.0030.00318.34
8.0.270.0070.00017.29
8.0.260.0000.00716.83
8.0.250.0000.00716.94
8.0.240.0000.00717.00
8.0.230.0030.00316.98
8.0.220.0070.00016.81
8.0.210.0000.00716.84
8.0.200.0000.00716.92
8.0.190.0030.00616.89
8.0.180.0000.00816.99
8.0.170.0030.00316.84
8.0.160.0000.00716.93
8.0.150.0030.00316.94
8.0.140.0000.00716.84
8.0.130.0030.00313.30
8.0.120.0000.00816.90
8.0.110.0070.00016.69
8.0.100.0040.00416.88
8.0.90.0000.00816.91
8.0.80.0130.00316.96
8.0.70.0050.00216.98
8.0.60.0070.00016.90
8.0.50.0000.00716.86
8.0.30.0120.00917.23
8.0.20.0110.00817.42
8.0.10.0040.00417.04
8.0.00.0060.01216.99
7.4.330.0030.00315.55
7.4.320.0060.00016.53
7.4.300.0000.00716.63
7.4.290.0050.00516.63
7.4.280.0040.00416.66
7.4.270.0050.00316.55
7.4.260.0050.00013.29
7.4.250.0040.00416.43
7.4.240.0070.00016.63
7.4.230.0070.00016.59
7.4.220.0090.00916.56
7.4.210.0150.00616.61
7.4.200.0030.00316.70
7.4.160.0060.01216.37
7.4.150.0060.01217.40
7.4.140.0090.00817.86
7.4.130.0170.00316.53
7.4.120.0090.00916.48
7.4.110.0070.01016.70
7.4.100.0090.01316.38
7.4.90.0060.01216.61
7.4.80.0140.00319.39
7.4.70.0040.01216.45
7.4.60.0030.01216.61
7.4.50.0110.00716.39
7.4.40.0090.01216.58
7.4.30.0090.00916.39
7.4.00.0040.00714.92
7.3.330.0050.00013.40
7.3.320.0030.00313.33
7.3.310.0030.00316.35
7.3.300.0070.00016.31
7.3.290.0100.00716.32
7.3.280.0090.00716.31
7.3.270.0100.00717.40
7.3.260.0130.00816.31
7.3.250.0100.00716.44
7.3.240.0010.01516.41
7.3.230.0060.01216.32
7.3.210.0070.01316.64
7.3.200.0110.01116.41
7.3.190.0000.01516.40
7.3.180.0080.00816.62
7.3.170.0130.00316.37
7.3.160.0080.00816.31
7.2.330.0130.00616.53
7.2.320.0130.00916.84
7.2.310.0060.01616.88
7.2.300.0120.00616.91
7.2.290.0060.01516.79
7.2.90.1710.00715.00
7.2.80.0080.01114.93
7.2.70.1360.00315.10
7.2.60.1180.00715.13
7.2.50.0070.01315.13
7.2.40.1460.00415.17
7.2.30.1090.00015.12
7.2.20.0890.00715.09
7.2.10.0740.00715.04
7.2.00.0660.01015.07
7.1.210.2280.00713.95
7.1.200.0080.00813.83
7.1.190.0950.00613.99
7.1.180.0580.01013.97
7.1.170.0100.01014.02
7.1.160.0090.00913.66
7.1.150.1210.01014.05
7.1.140.0090.01213.96
7.1.130.0910.00913.90
7.1.120.0820.00313.69
7.1.110.0830.00314.01
7.1.100.0890.00613.81
7.1.90.0730.00313.78
7.1.80.2220.01313.73
7.1.70.0140.00714.00
7.1.60.0720.01431.79
7.1.50.0330.01331.83
7.1.40.0770.01931.57
7.1.30.0850.01331.57
7.1.20.0250.01231.77
7.1.10.0730.01013.83
7.1.00.1970.00714.02
7.0.310.1650.00313.60
7.0.300.0030.01013.44
7.0.290.1620.00613.69
7.0.280.1130.00713.57
7.0.270.0790.00313.71
7.0.260.0710.00913.56
7.0.250.0050.01013.57
7.0.240.1060.00413.27
7.0.230.0700.00713.73
7.0.220.0660.00313.55
7.0.210.0150.00013.79
7.0.200.0090.00913.54
7.0.190.0070.01013.44
7.0.180.0110.00313.49
7.0.170.0180.00013.77
7.0.160.0850.00713.49
7.0.150.1220.00713.65
7.0.140.0600.02013.45
7.0.130.0710.00313.46
7.0.120.0730.00713.66
7.0.110.0680.00713.52
7.0.100.0770.00013.70
7.0.90.0710.01013.40
7.0.80.1830.01313.49
7.0.70.0650.01013.41
7.0.60.0920.00313.70
7.0.50.1630.00713.71
7.0.40.0960.01313.57
7.0.30.0120.00313.76
7.0.20.0060.00913.50
7.0.10.0080.00813.78
7.0.00.0220.01113.71

preferences:
40.67 ms | 400 KiB | 5 Q