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-CND4","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","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.0070.01018.43
8.3.50.0100.01016.77
8.3.40.0060.00919.11
8.3.30.0120.00318.73
8.3.20.0070.00020.37
8.3.10.0090.00023.65
8.3.00.0150.00019.46
8.2.180.0140.00718.29
8.2.170.0060.01322.96
8.2.160.0110.00318.98
8.2.150.0040.00424.18
8.2.140.0110.00424.66
8.2.130.0080.00019.33
8.2.120.0040.00426.35
8.2.110.0140.00719.39
8.2.100.0080.00417.67
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0000.00817.78
8.2.50.0090.00018.10
8.2.40.0040.00420.59
8.2.30.0030.00621.09
8.2.20.0040.00418.16
8.2.10.0040.00418.14
8.2.00.0040.00418.06
8.1.280.0060.00925.92
8.1.270.0120.00622.10
8.1.260.0040.00426.35
8.1.250.0040.01128.09
8.1.240.0030.00623.75
8.1.230.0090.00322.82
8.1.220.0030.00617.74
8.1.210.0030.00518.77
8.1.200.0000.00917.50
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0040.00418.56
8.1.160.0040.00419.04
8.1.150.0080.00018.91
8.1.140.0000.00817.54
8.1.130.0050.00318.96
8.1.120.0040.00417.54
8.1.110.0050.00217.41
8.1.100.0000.00717.51
8.1.90.0000.00817.34
8.1.80.0070.00017.53
8.1.70.0030.00317.41
8.1.60.0030.00617.61
8.1.50.0000.00817.55
8.1.40.0040.00417.46
8.1.30.0000.00717.64
8.1.20.0030.00517.60
8.1.10.0030.00517.57
8.1.00.0030.00517.41
8.0.300.0080.00018.77
8.0.290.0050.00216.75
8.0.280.0030.00318.37
8.0.270.0070.00017.28
8.0.260.0070.00016.76
8.0.250.0000.00716.96
8.0.240.0030.00316.89
8.0.230.0070.00016.96
8.0.220.0040.00416.89
8.0.210.0000.00716.80
8.0.200.0030.00316.99
8.0.190.0040.00416.96
8.0.180.0050.00216.94
8.0.170.0000.00816.91
8.0.160.0050.00216.82
8.0.150.0040.00416.85
8.0.140.0000.00716.88
8.0.130.0000.00813.34
8.0.120.0000.00816.84
8.0.110.0040.00416.88
8.0.100.0000.00816.94
8.0.90.0080.00016.81
8.0.80.0110.01116.81
8.0.70.0030.00516.89
8.0.60.0000.00816.83
8.0.50.0040.00416.93
8.0.30.0080.01017.12
8.0.20.0120.01217.40
8.0.10.0000.00816.82
8.0.00.0040.01316.71
7.4.330.0050.00015.55
7.4.320.0060.00016.54
7.4.300.0030.00316.60
7.4.290.0030.00616.50
7.4.280.0040.00416.49
7.4.270.0030.00316.49
7.4.260.0030.00616.61
7.4.250.0000.00816.48
7.4.240.0060.00316.39
7.4.230.0030.00316.46
7.4.220.0060.01216.58
7.4.210.0070.01616.51
7.4.200.0000.00716.73
7.4.160.0030.01316.48
7.4.150.0070.01317.40
7.4.140.0090.00917.86
7.4.130.0040.01416.60
7.4.120.0090.01316.51
7.4.110.0070.01016.47
7.4.100.0060.01116.49
7.4.90.0070.01016.51
7.4.80.0140.02319.39
7.4.70.0110.00616.49
7.4.60.0100.00716.44
7.4.50.0070.00716.61
7.4.40.0160.00616.67
7.4.30.0110.00616.35
7.4.00.0060.01015.07
7.3.330.0050.00013.19
7.3.320.0030.00213.33
7.3.310.0070.00016.31
7.3.300.0070.00016.33
7.3.290.0100.00416.32
7.3.280.0080.00916.31
7.3.270.0030.01517.40
7.3.260.0120.00916.38
7.3.250.0100.00716.42
7.3.240.0070.01116.59
7.3.230.0070.01016.52
7.3.210.0030.01316.55
7.3.200.0150.00316.51
7.3.190.0070.01016.40
7.3.180.0060.01516.33
7.3.170.0110.00616.39
7.3.160.0080.00816.37
7.3.10.0000.01216.66
7.3.00.0100.00016.82
7.2.330.0080.00816.83
7.2.320.0110.00916.71
7.2.310.0100.01216.34
7.2.300.0070.01016.82
7.2.290.0090.00916.56
7.2.130.0040.00716.94
7.2.120.0070.00417.05
7.2.110.0030.01016.98
7.2.100.0030.01216.74
7.2.90.0520.00715.73
7.2.80.0460.00215.82
7.2.70.0550.00615.98
7.2.60.0630.00516.02
7.2.50.0280.00815.96
7.2.40.0370.01015.95
7.2.30.0330.00816.01
7.2.20.0330.00515.79
7.2.10.0400.00915.99
7.2.00.0460.00216.14
7.1.250.0090.00315.54
7.1.210.1200.01014.05
7.1.200.1570.01013.96
7.1.190.0670.00613.95
7.1.180.0950.01013.78
7.1.170.0710.00613.74
7.1.160.0700.00313.90
7.1.150.0740.00613.94
7.1.140.0500.00713.65
7.1.130.0800.00713.84
7.1.120.0530.00314.04
7.1.110.0600.00013.63
7.1.100.0590.01313.71
7.1.90.0070.00714.07
7.1.80.0070.01013.95
7.1.70.0170.00714.10
7.1.60.1080.01731.91
7.1.50.0300.01331.96
7.1.40.0840.01031.84
7.1.30.0930.00631.40
7.1.20.0880.00631.86
7.1.10.0970.01013.68
7.1.00.0710.00713.88
7.0.310.0960.00313.43
7.0.300.0970.01013.26
7.0.290.0180.00813.68
7.0.280.0650.00713.60
7.0.270.0940.00313.36
7.0.260.0650.01113.50
7.0.250.0620.01313.73
7.0.240.1340.00713.58
7.0.230.0850.01013.47
7.0.220.0600.00613.73
7.0.210.0170.01113.73
7.0.200.0200.00513.43
7.0.190.1080.00013.41
7.0.180.0580.00613.38
7.0.170.0720.00013.67
7.0.160.0810.00313.69
7.0.150.0800.00913.59
7.0.140.0970.01313.61
7.0.130.2290.00613.38
7.0.120.0660.00713.55
7.0.110.0180.01213.64
7.0.100.0160.01213.66
7.0.90.0860.01013.37
7.0.80.1020.00713.50
7.0.70.0220.00313.57
7.0.60.0080.01413.71
7.0.50.0780.01113.66
7.0.40.1030.00313.79
7.0.30.1030.00613.77
7.0.20.0370.00713.51
7.0.10.0410.00013.75
7.0.00.0420.00813.48

preferences:
51.55 ms | 401 KiB | 5 Q