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-CND7","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":"naoehumemail.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.0100.00718.43
8.3.50.0170.00316.63
8.3.40.0140.00418.63
8.3.30.0110.00418.78
8.3.20.0000.00820.21
8.3.10.0040.00423.42
8.3.00.0080.00019.81
8.2.180.0070.01418.34
8.2.170.0070.00722.96
8.2.160.0040.01119.20
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0000.00821.14
8.2.120.0040.00426.35
8.2.110.0040.00420.35
8.2.100.0000.01217.97
8.2.90.0060.00319.21
8.2.80.0080.00018.05
8.2.70.0070.00317.75
8.2.60.0050.00318.05
8.2.50.0040.00418.10
8.2.40.0020.00520.53
8.2.30.0000.00819.20
8.2.20.0040.00418.18
8.2.10.0000.00818.02
8.2.00.0040.00418.06
8.1.280.0070.00725.92
8.1.270.0040.00422.10
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0060.00320.91
8.1.230.0110.00019.01
8.1.220.0060.00317.78
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0060.00318.56
8.1.160.0000.00719.03
8.1.150.0070.00020.75
8.1.140.0030.00719.61
8.1.130.0040.00418.83
8.1.120.0000.00717.55
8.1.110.0040.00417.40
8.1.100.0060.00317.38
8.1.90.0030.00517.41
8.1.80.0000.00717.36
8.1.70.0070.00017.37
8.1.60.0030.00617.60
8.1.50.0000.00917.44
8.1.40.0040.00417.44
8.1.30.0000.00817.64
8.1.20.0040.00717.62
8.1.10.0000.00817.61
8.1.00.0040.00417.51
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.47
8.0.270.0030.00317.29
8.0.260.0070.00016.84
8.0.250.0030.00316.85
8.0.240.0040.00416.86
8.0.230.0000.00716.89
8.0.220.0000.00716.92
8.0.210.0030.00316.92
8.0.200.0000.00816.82
8.0.190.0060.00316.85
8.0.180.0040.00416.98
8.0.170.0040.00416.96
8.0.160.0000.00716.84
8.0.150.0000.00716.86
8.0.140.0000.00716.86
8.0.130.0060.00013.32
8.0.120.0030.00616.80
8.0.110.0000.00716.90
8.0.100.0040.00416.82
8.0.90.0040.00416.75
8.0.80.0070.01016.87
8.0.70.0000.00716.80
8.0.60.0040.00416.97
8.0.50.0040.00416.77
8.0.30.0120.00917.09
8.0.20.0110.00717.40
8.0.10.0080.00017.02
8.0.00.0110.00816.86
7.4.330.0030.00215.55
7.4.320.0030.00316.45
7.4.300.0060.00016.52
7.4.290.0080.00316.51
7.4.280.0040.00416.44
7.4.270.0030.00516.63
7.4.260.0000.00613.28
7.4.250.0040.00416.43
7.4.240.0050.00316.63
7.4.230.0030.00316.57
7.4.220.0110.01416.70
7.4.210.0070.01416.60
7.4.200.0000.00716.55
7.4.160.0090.00716.62
7.4.150.0100.00717.40
7.4.140.0120.00717.86
7.4.130.0100.00916.46
7.4.120.0100.00916.56
7.4.110.0090.00916.49
7.4.100.0110.00716.59
7.4.90.0130.00716.54
7.4.80.0110.00819.39
7.4.70.0080.00816.61
7.4.60.0100.00616.40
7.4.50.0100.00616.55
7.4.40.0070.01016.46
7.4.30.0120.00616.57
7.4.10.0130.00716.38
7.4.00.0100.00715.54
7.3.330.0020.00213.25
7.3.320.0060.00013.33
7.3.310.0050.00316.43
7.3.300.0030.00316.35
7.3.290.0060.01116.32
7.3.280.0090.00816.30
7.3.270.0120.00617.40
7.3.260.0110.00616.33
7.3.250.0090.01016.53
7.3.240.0080.01116.39
7.3.230.0030.01416.18
7.3.210.0060.00916.52
7.3.200.0150.00016.60
7.3.190.0030.01616.59
7.3.180.0130.00616.23
7.3.170.0130.00316.26
7.3.160.0000.01616.60
7.3.130.0150.00616.27
7.3.120.0150.00416.30
7.3.110.0070.01116.58
7.3.100.0030.01316.36
7.3.90.0000.01616.16
7.3.80.0060.01416.22
7.3.70.0150.00616.24
7.3.60.0150.00416.34
7.3.50.0090.00916.18
7.3.40.0070.01516.40
7.3.30.0160.00416.50
7.3.20.0080.00818.23
7.3.10.0070.00817.41
7.3.00.0060.00717.51
7.2.330.0080.01016.49
7.2.320.0210.00316.82
7.2.310.0130.00916.64
7.2.300.0060.00916.31
7.2.290.0050.01216.44
7.2.260.0150.00416.74
7.2.250.0100.01316.80
7.2.240.0070.00416.64
7.2.230.0040.01616.64
7.2.220.0120.00416.85
7.2.210.0160.00316.41
7.2.200.0180.00316.67
7.2.190.0160.00616.46
7.2.180.0140.01016.66
7.2.170.0130.00416.66
7.2.160.0070.01116.41
7.2.150.0000.01318.53
7.2.140.0080.00818.48
7.2.130.0050.00817.65
7.2.120.0040.01117.68
7.2.110.0050.00817.71
7.2.100.0070.00817.54
7.2.90.0070.00817.27
7.2.80.0020.01017.37
7.2.70.0060.00817.50
7.2.60.0050.00817.39
7.2.50.0050.00817.52
7.2.40.0030.00917.55
7.2.30.0060.00717.46
7.2.20.0050.00617.47
7.2.10.0110.00417.49
7.2.00.0070.00617.34
7.1.330.0070.00717.31
7.1.320.0070.01417.16
7.1.310.0080.01417.38
7.1.300.0000.02017.26
7.1.290.0100.00717.00
7.1.280.0100.01017.32
7.1.270.0100.00317.25
7.1.260.0090.00317.11
7.1.250.0030.00916.60
7.1.240.0060.00617.27
7.1.230.0070.01117.27
7.1.220.0000.01317.30
7.1.210.0060.00816.46
7.1.200.0040.01016.47
7.1.190.0040.00816.46
7.1.180.0030.00916.39
7.1.170.0040.00916.53
7.1.160.0050.00816.40
7.1.150.0070.00716.49
7.1.140.0070.00416.39
7.1.130.0050.00716.53
7.1.120.0010.00916.38
7.1.110.0050.00816.65
7.1.100.0060.00516.58
7.1.90.0040.00716.55
7.1.80.0000.01616.49
7.1.70.0080.00416.41
7.1.60.0160.00525.50
7.1.50.0180.00725.38
7.1.40.0180.00525.36
7.1.30.0190.00225.60
7.1.20.0210.00625.50
7.1.10.0060.00716.62
7.1.00.0080.00516.66
7.0.330.0110.00416.88
7.0.320.0040.01116.94
7.0.310.0030.01016.20
7.0.300.0060.00716.20
7.0.290.0050.00716.31
7.0.280.0040.00916.16
7.0.270.0070.00416.20
7.0.260.0060.00416.05
7.0.250.0030.00716.15
7.0.240.0000.01116.07
7.0.230.0050.00916.16
7.0.220.0030.01216.22
7.0.210.0060.00716.38
7.0.200.0050.00516.16
7.0.190.0100.00316.15
7.0.180.0070.00316.14
7.0.170.0100.00416.14
7.0.160.0060.00716.16
7.0.150.0060.00816.33
7.0.140.0080.00416.29
7.0.130.0060.00616.11
7.0.120.0080.00716.20
7.0.110.0060.00616.14
7.0.100.0050.00916.24
7.0.90.0040.00616.15
7.0.80.0070.00416.29
7.0.70.0050.00616.17
7.0.60.0060.00716.22
7.0.50.0050.00816.22
7.0.40.0050.00615.18
7.0.30.0080.00615.17
7.0.20.0060.00815.23
7.0.10.0100.00315.07
7.0.00.0070.00215.11
5.6.400.0060.00615.75
5.6.390.0040.00716.00
5.6.380.0070.00715.93
5.6.370.0040.01116.02
5.6.360.0030.00616.26
5.6.350.0100.01015.98
5.6.340.0070.01015.68
5.6.330.0040.01116.25
5.6.320.0120.00015.76
5.6.310.0030.01216.29
5.6.300.0070.01016.30
5.6.290.0030.00715.84
5.6.280.0070.01015.88
5.6.270.0050.00516.06
5.6.260.0040.00816.05
5.6.250.0060.00615.78
5.6.240.0070.01016.16
5.6.230.0080.00316.23
5.6.220.0060.00915.82
5.6.210.0060.01015.93
5.6.200.0060.01315.76
5.6.190.0030.00915.97
5.6.180.0030.00916.18
5.6.170.0090.00315.83
5.6.160.0040.01115.82
5.6.150.0070.00715.89
5.6.140.0060.01015.92
5.6.130.0110.00415.68
5.6.120.0120.00015.77
5.6.110.0070.00715.82
5.6.100.0060.00915.84
5.6.90.0110.00315.92
5.6.80.0060.00615.93
5.6.70.0060.00615.66
5.6.60.0090.00615.79
5.6.50.0090.00615.79
5.6.40.0040.01115.84
5.6.30.0030.01315.96
5.6.20.0030.01015.66
5.6.10.0100.00716.11
5.6.00.0080.00815.71

preferences:
53.26 ms | 401 KiB | 5 Q