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":"payer@uolinc.com","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.0130.00618.68
8.3.50.0070.00716.39
8.3.40.0100.00719.03
8.3.30.0070.00718.84
8.3.20.0050.00320.20
8.3.10.0050.00323.53
8.3.00.0050.00319.68
8.2.180.0090.00918.54
8.2.170.0110.00322.96
8.2.160.0070.00719.12
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0050.00319.16
8.2.120.0000.00726.35
8.2.110.0000.00919.30
8.2.100.0090.00317.84
8.2.90.0050.00319.17
8.2.80.0030.00518.02
8.2.70.0100.00017.63
8.2.60.0080.00317.68
8.2.50.0040.00418.10
8.2.40.0040.00420.44
8.2.30.0030.00519.26
8.2.20.0040.00418.14
8.2.10.0070.00017.96
8.2.00.0000.00718.13
8.1.280.0110.00425.92
8.1.270.0050.00222.20
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0080.00022.01
8.1.230.0100.00019.16
8.1.220.0000.00917.79
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0060.00320.44
8.1.160.0070.00019.07
8.1.150.0000.00720.55
8.1.140.0080.00019.65
8.1.130.0070.00018.96
8.1.120.0030.00417.52
8.1.110.0000.00717.34
8.1.100.0040.00417.34
8.1.90.0040.00417.53
8.1.80.0000.00717.50
8.1.70.0030.00317.41
8.1.60.0000.00817.62
8.1.50.0050.00317.54
8.1.40.0070.00017.41
8.1.30.0050.00317.74
8.1.20.0070.00017.61
8.1.10.0000.00817.55
8.1.00.0060.00317.51
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0000.00818.46
8.0.270.0030.00317.21
8.0.260.0030.00316.80
8.0.250.0030.00316.96
8.0.240.0040.00416.99
8.0.230.0000.00716.98
8.0.220.0000.00816.80
8.0.210.0000.00716.88
8.0.200.0000.00717.01
8.0.190.0040.00417.00
8.0.180.0040.00416.99
8.0.170.0000.00716.95
8.0.160.0000.00716.80
8.0.150.0070.00016.85
8.0.140.0040.00416.86
8.0.130.0000.00713.38
8.0.120.0000.00816.78
8.0.110.0040.00416.78
8.0.100.0070.00016.90
8.0.90.0040.00416.73
8.0.80.0100.00516.83
8.0.70.0030.00616.72
8.0.60.0040.00416.72
8.0.50.0080.00016.85
8.0.30.0060.01217.23
8.0.20.0130.00517.40
8.0.10.0070.00016.80
8.0.00.0040.01316.55
7.4.330.0000.00615.55
7.4.320.0030.00316.55
7.4.300.0030.00316.53
7.4.290.0040.00716.51
7.4.280.0060.00316.50
7.4.270.0000.00716.57
7.4.260.0080.00016.46
7.4.250.0040.00416.63
7.4.240.0000.00716.50
7.4.230.0000.00716.55
7.4.220.0100.01016.66
7.4.210.0070.00616.57
7.4.200.0000.00716.65
7.4.160.0090.00716.55
7.4.150.0150.00317.40
7.4.140.0110.00717.86
7.4.130.0080.01216.66
7.4.120.0080.01316.63
7.4.110.0110.00616.75
7.4.100.0090.00916.61
7.4.90.0080.00916.42
7.4.80.0040.01519.39
7.4.70.0110.00516.51
7.4.60.0090.00616.58
7.4.50.0070.00716.61
7.4.40.0160.00016.54
7.4.30.0100.00716.56
7.4.10.0060.00814.63
7.4.00.0050.01115.10
7.3.330.0000.00513.19
7.3.320.0000.00613.31
7.3.310.0020.00516.20
7.3.300.0000.00716.32
7.3.290.0060.01016.31
7.3.280.0100.00716.30
7.3.270.0030.01517.40
7.3.260.0080.00916.50
7.3.250.0110.00816.52
7.3.240.0140.00616.51
7.3.230.0090.00616.66
7.3.210.0070.01016.56
7.3.200.0070.01416.38
7.3.190.0070.01016.61
7.3.180.0100.01316.55
7.3.170.0070.01016.31
7.3.160.0030.01316.39
7.3.130.0040.01515.04
7.3.120.0030.01415.01
7.3.110.0120.00415.02
7.3.100.0060.00614.86
7.3.90.0110.00314.79
7.3.80.0070.00714.98
7.3.70.0130.00314.73
7.3.60.0100.00614.84
7.3.50.0000.00814.72
7.3.40.0070.00714.71
7.3.30.0090.00914.71
7.3.20.0030.00616.63
7.3.10.0100.00616.70
7.3.00.0050.01016.65
7.2.330.0060.01116.50
7.2.320.0140.00416.88
7.2.310.0110.01216.85
7.2.300.0120.00416.82
7.2.290.0100.01316.87
7.2.260.0070.01115.01
7.2.250.0090.01015.10
7.2.240.0090.00614.87
7.2.230.0030.01015.33
7.2.220.0070.00714.89
7.2.210.0100.00714.76
7.2.200.0040.00815.15
7.2.190.0060.00614.88
7.2.180.0000.01015.23
7.2.170.0070.00714.96
7.2.160.0040.00714.89
7.2.150.0070.01016.68
7.2.140.0060.01016.99
7.2.130.0090.00616.92
7.2.120.0050.00816.98
7.2.110.0050.01116.96
7.2.100.0040.01116.89
7.2.90.0090.00716.13
7.2.80.0120.00416.22
7.2.70.0070.00716.20
7.2.60.0430.00716.39
7.2.50.0060.00816.07
7.2.40.0290.00516.20
7.2.30.0140.00816.37
7.2.20.0100.00616.17
7.2.10.0520.00916.48
7.2.00.0080.00716.29
7.1.330.0120.00315.74
7.1.320.0060.00915.77
7.1.310.0030.01215.86
7.1.300.0090.00015.90
7.1.290.0090.00615.86
7.1.280.0030.01415.83
7.1.270.0040.00415.55
7.1.260.0070.00715.43
7.1.250.0070.00715.78
7.1.240.0030.01015.83
7.1.230.0030.01015.71
7.1.220.0030.00615.64
7.1.210.0060.00815.00
7.1.200.0040.00715.09
7.1.190.0070.00915.12
7.1.180.0150.00715.27
7.1.170.0070.00715.01
7.1.160.0030.01015.08
7.1.150.0090.00415.14
7.1.140.0070.00615.25
7.1.130.0080.00915.06
7.1.120.0060.00615.16
7.1.110.0020.01215.07
7.1.100.0530.00415.19
7.1.90.0630.01015.19
7.1.80.0070.00915.01
7.1.70.0540.00515.13
7.1.60.0120.00721.12
7.1.50.0120.00821.18
7.1.40.0170.01021.02
7.1.30.0440.00921.14
7.1.20.0170.00621.04
7.1.10.0400.00915.04
7.1.00.0050.01015.14
7.0.330.0080.00315.44
7.0.320.0050.00815.34
7.0.310.0070.00614.78
7.0.300.0260.00414.64
7.0.290.0180.01014.68
7.0.280.0390.00614.78
7.0.270.0760.00814.68
7.0.260.0240.01014.79
7.0.250.0880.00814.72
7.0.240.0570.00614.88
7.0.230.0060.00814.65
7.0.220.0110.00514.91
7.0.210.0440.00614.75
7.0.200.0090.00914.71
7.0.190.0280.01114.92
7.0.180.0510.00714.81
7.0.170.0350.00614.81
7.0.160.0180.00114.74
7.0.150.0060.00714.69
7.0.140.0270.00514.73
7.0.130.0290.00914.83
7.0.120.0270.00914.90
7.0.110.0110.00414.78
7.0.100.0380.00914.84
7.0.90.0190.00714.88
7.0.80.0360.00414.85
7.0.70.0090.00714.75
7.0.60.0320.00614.65
7.0.50.0500.00714.77
7.0.40.0310.01113.49
7.0.30.0380.00313.43
7.0.20.0370.00513.58
7.0.10.0360.00713.34
7.0.00.0140.00813.49
5.6.400.0000.01214.57
5.6.390.0090.00614.55
5.6.380.0020.01114.45
5.6.370.0070.00714.45
5.6.360.0050.00514.34
5.6.350.0030.01014.64
5.6.340.0040.00714.61
5.6.330.0100.00714.72
5.6.320.0000.01414.46
5.6.310.0080.00014.67
5.6.300.0030.01314.65
5.6.290.0000.01414.41
5.6.280.0060.00614.49
5.6.270.0040.00814.36
5.6.260.0080.00614.29
5.6.250.0060.00614.54
5.6.240.0070.01014.38
5.6.230.0090.00614.45
5.6.220.0040.01114.26
5.6.210.0040.00814.38
5.6.200.0090.00314.23
5.6.190.0030.01114.35
5.6.180.0000.01214.29
5.6.170.0040.00414.32
5.6.160.0070.00314.50
5.6.150.0040.00714.12
5.6.140.0090.00014.63
5.6.130.0060.01214.50
5.6.120.0070.00614.21
5.6.110.0040.00914.53
5.6.100.0030.00614.63
5.6.90.0060.00614.66
5.6.80.0040.00714.27
5.6.70.0080.00014.28
5.6.60.0030.00714.51
5.6.50.0080.00614.43
5.6.40.0060.00614.18
5.6.30.0070.00714.30
5.6.20.0060.00914.23
5.6.10.0060.00614.59
5.6.00.0060.00614.23

preferences:
49.07 ms | 401 KiB | 5 Q