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":"en-US"},"payer":{"name":"João Pagão","email":"payer@uolinc.com","phone-area-code":"11","phone-number":"988881234","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.40.0110.00418.87
8.3.30.0120.00318.79
8.3.20.0050.00320.39
8.3.10.0060.00323.83
8.3.00.0000.00819.79
8.2.170.0100.00322.96
8.2.160.0110.00419.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00419.39
8.2.120.0040.00426.35
8.2.110.0060.00320.96
8.2.100.0060.00617.91
8.2.90.0040.00419.27
8.2.80.0000.00717.97
8.2.70.0030.00717.75
8.2.60.0060.00318.03
8.2.50.0000.00918.10
8.2.40.0040.00420.57
8.2.30.0030.00619.31
8.2.20.0050.00217.96
8.2.10.0000.00818.09
8.2.00.0070.00018.07
8.1.270.0060.00323.96
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0030.00819.14
8.1.230.0110.00019.01
8.1.220.0030.00517.79
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0060.00618.67
8.1.160.0040.00418.95
8.1.150.0040.00420.55
8.1.140.0030.00519.50
8.1.130.0070.00018.97
8.1.120.0040.00417.43
8.1.110.0000.00817.47
8.1.100.0040.00417.54
8.1.90.0000.00817.37
8.1.80.0040.00417.54
8.1.70.0030.00317.46
8.1.60.0040.00417.52
8.1.50.0030.00617.47
8.1.40.0050.00317.58
8.1.30.0040.00417.58
8.1.20.0000.00817.56
8.1.10.0030.00617.48
8.1.00.0000.00717.42
8.0.300.0040.00418.77
8.0.290.0050.00216.58
8.0.280.0000.00718.47
8.0.270.0000.00717.27
8.0.260.0060.00016.76
8.0.250.0040.00416.88
8.0.240.0030.00316.95
8.0.230.0030.00316.89
8.0.220.0000.00716.92
8.0.210.0030.00316.93
8.0.200.0000.00716.93
8.0.190.0050.00316.97
8.0.180.0000.00716.96
8.0.170.0000.00816.85
8.0.160.0000.00816.93
8.0.150.0070.00016.78
8.0.140.0000.00716.75
8.0.130.0080.00013.30
8.0.120.0040.00416.87
8.0.110.0070.00016.90
8.0.100.0050.00316.91
8.0.90.0000.00716.71
8.0.80.0040.01716.92
8.0.70.0080.00016.89
8.0.60.0050.00216.81
8.0.50.0040.00416.82
8.0.30.0110.00816.88
8.0.20.0090.01117.41
8.0.10.0050.00216.86
8.0.00.0060.01216.89
7.4.330.0050.00015.55
7.4.320.0030.00316.64
7.4.300.0030.00316.53
7.4.290.0060.00316.62
7.4.280.0060.00316.50
7.4.270.0070.00016.52
7.4.260.0040.00716.43
7.4.250.0000.00816.61
7.4.240.0000.00716.63
7.4.230.0000.00716.63
7.4.220.0090.00916.69
7.4.210.0040.00816.64
7.4.200.0030.00316.62
7.4.160.0070.00816.65
7.4.150.0160.00317.40
7.4.140.0090.00917.86
7.4.130.0100.01116.41
7.4.120.0150.00916.51
7.4.110.0070.01016.42
7.4.100.0030.02116.59
7.4.90.0100.00716.55
7.4.80.0000.01719.39
7.4.70.0030.01316.45
7.4.60.0090.00816.45
7.4.50.0070.00716.44
7.4.40.0090.00916.45
7.4.30.0070.01016.45
7.4.10.0050.01214.90
7.4.00.0100.00614.94
7.3.330.0020.00213.16
7.3.320.0060.00013.35
7.3.310.0000.00716.13
7.3.300.0060.00016.33
7.3.290.0110.00716.34
7.3.280.0070.00816.33
7.3.270.0110.01417.40
7.3.260.0080.01016.36
7.3.250.0080.00916.23
7.3.240.0100.00916.29
7.3.230.0110.00516.24
7.3.210.0100.00616.20
7.3.200.0090.00916.20
7.3.190.0130.00316.65
7.3.180.0080.01316.61
7.3.170.0030.01316.55
7.3.160.0030.01416.71
7.3.130.0090.00914.88
7.3.120.0060.01114.93
7.3.110.0030.01114.88
7.3.100.0060.00814.86
7.3.90.0040.01014.75
7.3.80.0070.00714.79
7.3.70.0070.00814.80
7.3.60.0080.00714.75
7.3.50.0070.01114.84
7.3.40.0060.00714.82
7.3.30.0050.00714.71
7.3.20.0060.00516.61
7.3.10.0090.00516.63
7.3.00.0040.00916.61
7.2.330.0130.00616.82
7.2.320.0140.00316.80
7.2.310.0150.00416.72
7.2.300.0060.01216.67
7.2.290.0140.00716.76
7.2.260.0070.00915.12
7.2.250.0090.01015.11
7.2.240.0060.00914.96
7.2.230.0090.00615.16
7.2.220.0050.01215.18
7.2.210.0060.01014.94
7.2.200.0080.00615.16
7.2.190.0030.01415.12
7.2.180.0090.00715.05
7.2.170.0090.00415.05
7.2.160.0060.01015.06
7.2.150.0070.00716.75
7.2.140.0080.00516.96
7.2.130.0050.00716.92
7.2.120.0070.00616.78
7.2.110.0050.00716.84
7.2.100.0060.01116.82
7.2.90.0780.00816.38
7.2.80.0730.00916.29
7.2.70.1080.01116.41
7.2.60.1070.00916.29
7.2.50.0940.00616.48
7.2.40.0960.00716.41
7.2.30.0920.00716.48
7.2.20.0660.01016.35
7.2.10.0820.01016.46
7.2.00.0700.00716.44
7.1.330.0070.00615.75
7.1.320.0040.01015.74
7.1.310.0100.00415.56
7.1.300.0060.00915.63
7.1.290.0060.01015.72
7.1.280.0060.00815.66
7.1.270.0080.00515.78
7.1.260.0100.00415.57
7.1.250.0060.00515.64
7.1.240.0050.01015.52
7.1.230.0050.01415.79
7.1.220.0080.00815.68
7.1.210.0520.00615.13
7.1.200.0850.00815.16
7.1.190.1000.00915.05
7.1.180.1370.00515.20
7.1.170.0800.00815.01
7.1.160.0960.00815.17
7.1.150.1190.00615.09
7.1.140.0860.00515.12
7.1.130.0700.00714.92
7.1.120.0550.00815.03
7.1.110.0910.00914.99
7.1.100.0860.01015.02
7.1.90.0930.00715.04
7.1.80.0980.00615.07
7.1.70.0730.00814.93
7.1.60.0810.01021.09
7.1.50.0480.00920.89
7.1.40.0560.01221.25
7.1.30.0350.00821.05
7.1.20.0440.01320.93
7.1.10.0510.00315.11
7.1.00.0300.00615.17
7.0.330.0010.01015.32
7.0.320.0060.01115.49
7.0.310.0850.00614.83
7.0.300.0890.00614.80
7.0.290.0910.00914.84
7.0.280.0840.01114.60
7.0.270.1190.00614.63
7.0.260.1100.00514.70
7.0.250.0670.01114.63
7.0.240.0800.01014.82
7.0.230.1110.00414.78
7.0.220.1000.00614.78
7.0.210.0590.00614.88
7.0.200.1110.01014.78
7.0.190.0430.00514.74
7.0.180.0330.00914.88
7.0.170.0380.00514.78
7.0.160.0460.00514.80
7.0.150.0630.00714.75
7.0.140.0320.00714.74
7.0.130.0370.00614.67
7.0.120.0240.00414.60
7.0.110.0230.01014.78
7.0.100.0250.00614.75
7.0.90.0380.00614.84
7.0.80.0360.00714.81
7.0.70.0090.00814.77
7.0.60.0890.00514.76
7.0.50.0370.00814.96
7.0.40.0090.00613.51
7.0.30.0390.00713.60
7.0.20.0280.01013.33
7.0.10.0090.01113.46
7.0.00.0380.00713.50
5.6.400.0040.01114.41
5.6.390.0050.00814.38
5.6.380.0000.00914.55
5.6.370.0050.00814.32
5.6.360.0060.00614.51
5.6.350.0040.00914.26
5.6.340.0010.01114.49
5.6.330.0080.00514.48
5.6.320.0050.00914.20
5.6.310.0040.00814.47
5.6.300.0090.00514.50
5.6.290.0090.00614.38
5.6.280.0080.00514.47
5.6.270.0070.00914.23
5.6.260.0060.01014.39
5.6.250.0070.00714.31
5.6.240.0040.00914.49
5.6.230.0040.00614.25
5.6.220.0090.00614.51
5.6.210.0050.00914.32
5.6.200.0070.00914.30
5.6.190.0050.00614.43
5.6.180.0040.00914.41
5.6.170.0070.00614.59
5.6.160.0010.00914.65
5.6.150.0080.00214.44
5.6.140.0030.01014.49
5.6.130.0070.00714.49
5.6.120.0110.00314.23
5.6.110.0060.00614.48
5.6.100.0030.00614.27
5.6.90.0010.00914.52
5.6.80.0040.00914.16
5.6.70.0030.01114.22
5.6.60.0050.01114.23
5.6.50.0050.01014.31
5.6.40.0060.00914.33
5.6.30.0100.00314.35
5.6.20.0050.00714.20
5.6.10.0080.00514.12
5.6.00.0030.00614.23

preferences:
49.44 ms | 400 KiB | 5 Q