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-CND3","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.0090.01216.88
8.3.50.0090.00616.55
8.3.40.0150.00618.92
8.3.30.0190.00018.86
8.3.20.0050.00220.16
8.3.10.0080.00023.58
8.3.00.0050.00319.66
8.2.180.0090.00918.50
8.2.170.0040.01122.96
8.2.160.0100.00319.21
8.2.150.0070.01324.18
8.2.140.0050.00324.66
8.2.130.0080.00019.33
8.2.120.0040.00426.35
8.2.110.0060.00320.52
8.2.100.0110.00017.97
8.2.90.0040.00419.22
8.2.80.0040.00417.97
8.2.70.0000.00917.75
8.2.60.0080.00018.05
8.2.50.0080.00018.10
8.2.40.0000.00920.42
8.2.30.0040.00421.14
8.2.20.0070.00018.08
8.2.10.0000.00718.08
8.2.00.0020.00518.01
8.1.280.0140.00325.92
8.1.270.0080.00022.22
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0070.00320.84
8.1.230.0070.00419.17
8.1.220.0090.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0030.00617.23
8.1.180.0000.00718.10
8.1.170.0000.00818.59
8.1.160.0040.00418.91
8.1.150.0040.00418.85
8.1.140.0030.00619.52
8.1.130.0000.00818.82
8.1.120.0070.00017.55
8.1.110.0000.00817.33
8.1.100.0000.00817.48
8.1.90.0070.00017.46
8.1.80.0050.00217.39
8.1.70.0000.00717.50
8.1.60.0000.00917.54
8.1.50.0040.00417.51
8.1.40.0030.00617.41
8.1.30.0040.00417.63
8.1.20.0070.00017.63
8.1.10.0030.00517.62
8.1.00.0040.00417.54
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0000.00718.52
8.0.270.0070.00017.29
8.0.260.0030.00316.84
8.0.250.0030.00316.99
8.0.240.0040.00416.96
8.0.230.0040.00416.84
8.0.220.0030.00316.93
8.0.210.0050.00216.81
8.0.200.0000.00616.97
8.0.190.0090.00016.93
8.0.180.0000.00916.83
8.0.170.0030.00316.91
8.0.160.0070.00016.85
8.0.150.0000.00716.89
8.0.140.0000.00716.79
8.0.130.0000.00513.30
8.0.120.0000.00916.79
8.0.110.0000.00816.79
8.0.100.0040.00416.93
8.0.90.0000.00716.82
8.0.80.0060.00916.82
8.0.70.0030.00616.98
8.0.60.0040.00416.98
8.0.50.0040.00416.90
8.0.30.0090.00917.17
8.0.20.0100.01017.41
8.0.10.0030.00317.00
8.0.00.0130.00616.73
7.4.330.0050.00015.55
7.4.320.0030.00316.45
7.4.300.0040.00416.61
7.4.290.0030.00316.53
7.4.280.0000.00816.50
7.4.270.0000.00716.53
7.4.260.0000.00816.62
7.4.250.0000.00816.58
7.4.240.0080.00016.61
7.4.230.0000.00716.63
7.4.220.0030.01416.63
7.4.210.0120.00316.66
7.4.200.0030.00316.58
7.4.160.0110.00716.55
7.4.150.0180.00017.40
7.4.140.0100.00717.86
7.4.130.0060.01416.43
7.4.120.0130.00616.40
7.4.110.0060.01116.63
7.4.100.0170.00316.43
7.4.90.0060.01116.56
7.4.80.0040.01219.39
7.4.70.0110.00616.50
7.4.60.0030.01316.63
7.4.50.0000.01616.60
7.4.40.0120.00616.70
7.4.30.0060.01016.74
7.4.00.0100.00715.08
7.3.330.0000.00613.14
7.3.320.0050.00013.33
7.3.310.0070.00016.23
7.3.300.0000.00716.18
7.3.290.0090.00816.34
7.3.280.0050.01216.30
7.3.270.0100.00717.40
7.3.260.0080.00916.34
7.3.250.0100.00916.30
7.3.240.0100.00916.42
7.3.230.0070.01416.45
7.3.210.0070.01116.63
7.3.200.0070.01016.59
7.3.190.0100.01116.46
7.3.180.0060.00916.36
7.3.170.0170.00016.43
7.3.160.0110.00616.31
7.3.120.0080.01214.86
7.3.110.0100.01014.95
7.3.100.0100.01014.79
7.3.90.0070.00714.93
7.3.80.0030.01014.82
7.3.70.0000.00914.69
7.3.60.0130.00314.68
7.3.50.0030.01014.45
7.3.40.0090.00614.89
7.3.30.0090.00314.54
7.3.20.0090.00916.82
7.3.10.0030.00816.54
7.3.00.0050.01016.54
7.2.330.0070.01016.83
7.2.320.0060.01016.89
7.2.310.0090.00616.83
7.2.300.0120.01016.54
7.2.290.0130.00716.79
7.2.250.0060.01315.01
7.2.240.0040.01514.98
7.2.230.0120.00415.08
7.2.220.0000.01615.30
7.2.210.0030.01015.09
7.2.200.0030.01315.19
7.2.190.0040.01115.02
7.2.180.0040.00814.82
7.2.170.0070.00715.13
7.2.160.0030.01015.10
7.2.150.0040.00716.96
7.2.140.0100.00317.05
7.2.130.0040.01016.93
7.2.120.0050.01016.88
7.2.110.0000.01316.93
7.2.100.0070.00917.00
7.2.90.0360.00616.31
7.2.80.0070.01016.10
7.2.70.0200.01016.24
7.2.60.0060.01116.27
7.2.50.0050.01116.27
7.2.40.0100.00816.38
7.2.30.1050.01016.27
7.2.20.0240.00616.34
7.2.10.0070.00916.30
7.2.00.0100.00616.16
7.1.330.0120.00015.90
7.1.320.0130.00015.57
7.1.310.0060.00615.90
7.1.300.0030.00515.55
7.1.290.0100.00315.67
7.1.280.0000.00815.61
7.1.270.0060.00915.70
7.1.260.0110.00415.65
7.1.250.0020.01015.88
7.1.240.0030.01215.80
7.1.230.0030.01415.77
7.1.220.0070.00315.41
7.1.210.0220.00714.90
7.1.200.0170.00914.75
7.1.190.0060.00814.95
7.1.180.0530.00114.71
7.1.170.0000.01814.79
7.1.160.0090.01114.54
7.1.150.0030.01314.73
7.1.140.0050.01114.71
7.1.130.0060.00514.85
7.1.120.0090.01114.70
7.1.110.0050.00914.71
7.1.100.1220.00914.92
7.1.90.0220.00314.53
7.1.80.0090.00914.66
7.1.70.0750.00714.74
7.1.60.0710.00623.71
7.1.50.1050.01523.74
7.1.40.0820.01023.70
7.1.30.0560.00823.59
7.1.20.0390.01323.76
7.1.10.0430.00314.86
7.1.00.0410.00214.93
7.0.330.0030.01015.40
7.0.320.0000.01015.41
7.0.310.0050.01114.54
7.0.300.0950.00914.40
7.0.290.0100.00914.49
7.0.280.0080.00714.29
7.0.270.0200.00714.53
7.0.260.0090.01014.47
7.0.250.0340.00814.54
7.0.240.1220.01314.56
7.0.230.0260.00814.43
7.0.220.1000.01014.46
7.0.210.0100.00414.60
7.0.200.1200.00614.54
7.0.190.0590.00714.63
7.0.180.0500.00214.46
7.0.170.0620.01014.45
7.0.160.0580.00314.48
7.0.150.1420.00814.64
7.0.140.0430.00914.54
7.0.130.0360.00914.53
7.0.120.0460.00214.64
7.0.110.0620.00914.52
7.0.100.0690.01014.47
7.0.90.0390.00614.59
7.0.80.0450.00814.26
7.0.70.0430.00514.44
7.0.60.0550.01014.56
7.0.50.0520.00514.51
7.0.40.0530.00513.52
7.0.30.0370.01313.43
7.0.20.0500.00313.50
7.0.10.0580.00613.68
7.0.00.0340.00913.53
5.6.400.0000.01014.52
5.6.390.0090.00614.40
5.6.380.0060.00614.53
5.6.370.0090.00614.05
5.6.360.0070.00714.05
5.6.350.0070.01014.06
5.6.340.0060.00614.32
5.6.330.0090.00614.48
5.6.320.0060.00914.36
5.6.310.0070.00314.62
5.6.300.0030.01314.53
5.6.290.0090.00314.71
5.6.280.0000.01314.13
5.6.270.0100.01014.04
5.6.260.0040.01514.23
5.6.250.0060.01314.19
5.6.240.0060.00614.52
5.6.230.0040.00914.29
5.6.220.0070.00714.27
5.6.210.0030.01014.48
5.6.200.0040.01214.07
5.6.190.0110.00714.69
5.6.180.0030.01214.35
5.6.170.0030.00914.16
5.6.160.0060.00614.48
5.6.150.0000.01514.25
5.6.140.0060.00614.47
5.6.130.0030.01314.55
5.6.120.0000.01614.62
5.6.110.0030.01514.21
5.6.100.0060.00914.30
5.6.90.0070.00714.38
5.6.80.0120.00614.06
5.6.70.0030.00714.62
5.6.60.0030.01014.27
5.6.50.0030.00714.60
5.6.40.0000.01514.25
5.6.30.0040.00714.21
5.6.20.0000.01114.29
5.6.10.0000.01414.46
5.6.00.0040.01114.64

preferences:
48.22 ms | 400 KiB | 5 Q