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-CND6","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEiLCJkZiI6IjJmOTExZjdkOTgyZDQzMDY4YTNmYjc2MWRlZWQzZjI1In0=","notify-url":"https://virtual-store.com/notifications/","test-mode": 0,"payment-group":"credit_card","country":"BR"},"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.0090.00918.80
8.3.50.0070.01316.61
8.3.40.0110.00718.96
8.3.30.0080.00819.02
8.3.20.0040.00420.25
8.3.10.0040.00423.72
8.3.00.0000.00819.66
8.2.180.0140.00718.54
8.2.170.0110.00322.96
8.2.160.0090.00619.21
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00421.18
8.2.120.0040.00426.35
8.2.110.0060.00322.29
8.2.100.0030.00817.97
8.2.90.0100.00019.22
8.2.80.0080.00018.04
8.2.70.0000.00817.75
8.2.60.0000.00817.80
8.2.50.0030.00618.10
8.2.40.0040.00420.60
8.2.30.0050.00319.26
8.2.20.0050.00318.07
8.2.10.0000.00818.04
8.2.00.0040.00418.13
8.1.280.0040.01125.92
8.1.270.0050.00222.20
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0000.00920.96
8.1.230.0070.00419.17
8.1.220.0070.00317.74
8.1.210.0000.00918.77
8.1.200.0060.00317.50
8.1.190.0030.00517.23
8.1.180.0020.00518.10
8.1.170.0100.00018.71
8.1.160.0070.00019.07
8.1.150.0000.00720.69
8.1.140.0050.00319.60
8.1.130.0030.00318.96
8.1.120.0000.00717.45
8.1.110.0000.00717.39
8.1.100.0000.00817.51
8.1.90.0030.00317.54
8.1.80.0040.00417.45
8.1.70.0040.00417.43
8.1.60.0030.00617.51
8.1.50.0030.00617.55
8.1.40.0050.00317.55
8.1.30.0000.00717.70
8.1.20.0040.00417.68
8.1.10.0020.00517.53
8.1.00.0040.00417.58
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.34
8.0.270.0040.00417.25
8.0.260.0040.00416.74
8.0.250.0030.00317.00
8.0.240.0000.00816.91
8.0.230.0070.00016.88
8.0.220.0030.00316.95
8.0.210.0000.00716.79
8.0.200.0030.00316.87
8.0.190.0040.00416.93
8.0.180.0040.00416.85
8.0.170.0050.00216.84
8.0.160.0040.00416.94
8.0.150.0000.00816.76
8.0.140.0050.00316.78
8.0.130.0000.00513.22
8.0.120.0000.00816.83
8.0.110.0070.00016.79
8.0.100.0040.00416.93
8.0.90.0040.00416.90
8.0.80.0070.01016.80
8.0.70.0000.00716.87
8.0.60.0040.00416.88
8.0.50.0040.00416.80
8.0.30.0130.00717.20
8.0.20.0130.01217.40
8.0.10.0040.00416.85
8.0.00.0100.00716.75
7.4.330.0000.00515.55
7.4.320.0030.00316.62
7.4.300.0000.00616.63
7.4.290.0070.00316.57
7.4.280.0040.00416.53
7.4.270.0050.00316.67
7.4.260.0050.00013.24
7.4.250.0000.00716.49
7.4.240.0000.00716.52
7.4.230.0030.00316.52
7.4.220.0190.00016.42
7.4.210.0070.01316.48
7.4.200.0070.00016.62
7.4.160.0140.00516.73
7.4.150.0110.00617.40
7.4.140.0100.00817.86
7.4.130.0100.01816.56
7.4.120.0110.00716.54
7.4.110.0090.00916.58
7.4.100.0090.00916.56
7.4.90.0100.00716.61
7.4.80.0130.00619.39
7.4.70.0000.01616.27
7.4.60.0090.00616.45
7.4.50.0100.00316.39
7.4.40.0080.00816.57
7.4.30.0110.00916.29
7.4.10.0000.01214.98
7.4.00.0060.00915.03
7.3.330.0000.00513.29
7.3.320.0060.00013.15
7.3.310.0070.00016.22
7.3.300.0030.00316.34
7.3.290.0060.01016.34
7.3.280.0090.00716.31
7.3.270.0120.00617.40
7.3.260.0140.00616.51
7.3.250.0090.00916.48
7.3.240.0090.00916.39
7.3.230.0030.01416.61
7.3.210.0110.00516.35
7.3.200.0090.00916.48
7.3.190.0050.01316.46
7.3.180.0100.01216.55
7.3.170.0130.00316.27
7.3.160.0060.01016.61
7.3.130.0110.00715.07
7.3.120.0070.00914.87
7.3.110.0070.01014.88
7.3.100.0110.00414.80
7.3.90.0060.00714.73
7.3.80.0080.00714.83
7.3.70.0050.00914.74
7.3.60.0050.01014.73
7.3.50.0070.00614.75
7.3.40.0050.00714.85
7.3.30.0070.00714.79
7.3.20.0070.00416.60
7.3.10.0080.00416.55
7.3.00.0070.00716.49
7.2.330.0070.01016.32
7.2.320.0110.00616.87
7.2.310.0140.01016.81
7.2.300.0050.01316.78
7.2.290.0040.01416.73
7.2.260.0070.01114.87
7.2.250.0070.01115.13
7.2.240.0090.00715.09
7.2.230.0060.01015.27
7.2.220.0050.00915.11
7.2.210.0050.01015.07
7.2.200.0040.01114.95
7.2.190.0050.00815.15
7.2.180.0080.00515.11
7.2.170.0040.01015.19
7.2.160.0030.01114.98
7.2.150.0030.00916.99
7.2.140.0060.00716.82
7.2.130.0060.00817.00
7.2.120.0030.01116.94
7.2.110.0080.00217.02
7.2.100.0080.00717.03
7.2.90.0150.00716.40
7.2.80.0130.00816.45
7.2.70.0130.00816.49
7.2.60.0150.00916.53
7.2.50.0170.00916.48
7.2.40.0050.00916.49
7.2.30.0080.00816.42
7.2.20.0140.00816.53
7.2.10.0070.00916.49
7.2.00.0090.00616.47
7.1.330.0040.01015.81
7.1.320.0050.01015.65
7.1.310.0110.00215.74
7.1.300.0050.00815.79
7.1.290.0050.00715.67
7.1.280.0070.00915.56
7.1.270.0070.00815.61
7.1.260.0060.00815.64
7.1.250.0060.01015.68
7.1.240.0040.00715.74
7.1.230.0060.00615.75
7.1.220.0060.00815.85
7.1.210.0190.00415.26
7.1.200.0070.00715.09
7.1.190.0150.01115.13
7.1.180.0080.00715.21
7.1.170.0180.00615.17
7.1.160.0160.01115.12
7.1.150.0110.00915.18
7.1.140.0140.00614.92
7.1.130.0040.00715.05
7.1.120.0190.00715.06
7.1.110.0140.00615.20
7.1.100.0110.00815.23
7.1.90.0190.00614.93
7.1.80.0180.00615.18
7.1.70.0190.01015.20
7.1.60.0200.00421.11
7.1.50.0330.01121.11
7.1.40.0510.01121.14
7.1.30.0260.00421.02
7.1.20.0190.00921.05
7.1.10.0190.00415.13
7.1.00.0080.01115.05
7.0.330.0060.00815.23
7.0.320.0020.01015.28
7.0.310.0130.00614.76
7.0.300.0170.00414.67
7.0.290.0110.00514.70
7.0.280.0170.00714.80
7.0.270.0130.00714.67
7.0.260.0170.00714.78
7.0.250.0140.00914.83
7.0.240.0190.00414.76
7.0.230.0060.00814.81
7.0.220.0170.00614.83
7.0.210.0140.00614.79
7.0.200.0210.00714.70
7.0.190.0190.00814.76
7.0.180.0050.00914.79
7.0.170.0170.00914.80
7.0.160.0130.00414.68
7.0.150.0210.00614.79
7.0.140.0110.00414.75
7.0.130.0060.00814.80
7.0.120.0180.00714.85
7.0.110.0210.00414.81
7.0.100.0030.01014.72
7.0.90.0030.00814.70
7.0.80.0250.00814.75
7.0.70.0100.00514.66
7.0.60.0190.01014.81
7.0.50.0080.00614.79
7.0.40.0150.00913.40
7.0.30.0080.00613.69
7.0.20.0110.00713.56
7.0.10.0200.00613.50
7.0.00.0060.00713.50
5.6.400.0070.00514.64
5.6.390.0050.00814.58
5.6.380.0070.01014.45
5.6.370.0070.00714.18
5.6.360.0080.00814.42
5.6.350.0030.01114.59
5.6.340.0040.00914.56
5.6.330.0030.00714.49
5.6.320.0060.00614.39
5.6.310.0050.01014.48
5.6.300.0110.00514.29
5.6.290.0060.00814.38
5.6.280.0050.01014.61
5.6.270.0020.01214.51
5.6.260.0030.00814.28
5.6.250.0070.00714.44
5.6.240.0040.01014.63
5.6.230.0090.00314.32
5.6.220.0070.00714.56
5.6.210.0020.00914.51
5.6.200.0060.00614.38
5.6.190.0060.00614.29
5.6.180.0060.00614.31
5.6.170.0080.00814.52
5.6.160.0070.00714.49
5.6.150.0050.00614.28
5.6.140.0070.00814.54
5.6.130.0050.00514.38
5.6.120.0050.00814.47
5.6.110.0050.00814.34
5.6.100.0070.00414.39
5.6.90.0050.00714.07
5.6.80.0070.00414.10
5.6.70.0020.01314.21
5.6.60.0090.00314.14
5.6.50.0090.00514.34
5.6.40.0020.01314.19
5.6.30.0080.00714.30
5.6.20.0080.00514.35
5.6.10.0080.00414.35
5.6.00.0060.00414.24

preferences:
48.45 ms | 400 KiB | 5 Q