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-CND10","direct-token":"eyJpcCI6IjE3Mi4yMS4xMTIuMTYxIiwiZGYiOiIyZjkxMWY3ZDk4MmQ0MzA2OGEzZmI3NjFkZWVkM2YyNSJ9","notify-url":"https://virtual-store.com/notifications/","test-mode": 0,"payment-group":"credit_card","country":"BR","language":"cebolas"},"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.70.0130.00617.00
8.3.60.0110.01118.68
8.3.50.0130.00516.76
8.3.40.0130.00618.64
8.3.30.0070.00718.73
8.3.20.0090.00020.33
8.3.10.0040.00423.71
8.3.00.0050.00319.92
8.2.180.0110.01118.51
8.2.170.0060.00922.96
8.2.160.0080.00819.01
8.2.150.0100.00024.18
8.2.140.0000.00724.66
8.2.130.0040.00419.32
8.2.120.0040.00426.35
8.2.110.0070.00320.54
8.2.100.0080.00417.91
8.2.90.0040.00419.26
8.2.80.0050.00318.04
8.2.70.0030.00617.46
8.2.60.0080.00417.80
8.2.50.0040.00418.10
8.2.40.0000.00720.55
8.2.30.0000.00819.27
8.2.20.0000.00718.07
8.2.10.0040.00418.14
8.2.00.0000.00818.03
8.1.280.0140.00025.92
8.1.270.0080.00022.19
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.62
8.1.230.0040.00719.00
8.1.220.0080.00017.76
8.1.210.0030.00518.77
8.1.200.0080.00017.47
8.1.190.0060.00317.23
8.1.180.0050.00318.10
8.1.170.0000.01118.59
8.1.160.0000.00719.03
8.1.150.0000.00720.55
8.1.140.0070.00019.59
8.1.130.0040.00418.78
8.1.120.0030.00517.45
8.1.110.0030.00617.27
8.1.100.0000.00917.38
8.1.90.0040.00417.53
8.1.80.0000.00717.50
8.1.70.0030.00317.53
8.1.60.0040.00417.53
8.1.50.0050.00317.55
8.1.40.0110.00017.56
8.1.30.0050.00317.70
8.1.20.0070.00017.59
8.1.10.0000.00817.62
8.1.00.0040.00417.41
8.0.300.0030.00518.77
8.0.290.0040.00416.58
8.0.280.0030.00318.34
8.0.270.0000.00717.19
8.0.260.0030.00316.90
8.0.250.0030.00517.07
8.0.240.0040.00416.98
8.0.230.0040.00417.02
8.0.220.0030.00316.94
8.0.210.0070.00016.90
8.0.200.0040.00416.87
8.0.190.0040.00416.88
8.0.180.0040.00416.92
8.0.170.0040.00416.98
8.0.160.0070.00016.78
8.0.150.0070.00016.75
8.0.140.0000.00816.78
8.0.130.0060.00013.43
8.0.120.0080.00016.91
8.0.110.0000.00816.93
8.0.100.0000.00716.98
8.0.90.0040.00416.80
8.0.80.0030.01316.88
8.0.70.0070.00016.82
8.0.60.0040.00416.97
8.0.50.0030.00516.87
8.0.30.0090.00917.14
8.0.20.0150.02017.40
8.0.10.0040.00416.79
8.0.00.0050.01116.60
7.4.330.0020.00215.55
7.4.320.0000.00616.64
7.4.300.0000.00716.66
7.4.290.0060.00616.50
7.4.280.0040.00416.45
7.4.270.0030.00316.61
7.4.260.0050.00013.32
7.4.250.0000.00716.36
7.4.240.0050.00316.66
7.4.230.0030.00316.50
7.4.220.0120.00616.48
7.4.210.0150.00616.45
7.4.200.0000.00716.70
7.4.160.0060.01216.55
7.4.150.0110.00617.40
7.4.140.0080.01117.86
7.4.130.0110.00716.64
7.4.120.0090.01116.39
7.4.110.0130.00316.70
7.4.100.0030.01416.64
7.4.90.0060.01016.60
7.4.80.0130.00319.39
7.4.70.0030.01316.64
7.4.60.0120.00416.55
7.4.50.0150.00016.46
7.4.40.0120.00916.42
7.4.30.0100.00616.63
7.4.00.0050.01314.89
7.3.330.0030.00313.20
7.3.320.0000.00613.32
7.3.310.0000.00716.23
7.3.300.0000.00716.34
7.3.290.0090.00716.31
7.3.280.0080.00816.33
7.3.270.0120.00617.40
7.3.260.0060.01216.34
7.3.250.0070.01216.44
7.3.240.0030.01416.46
7.3.230.0130.00316.39
7.3.210.0050.01416.55
7.3.200.0150.00316.40
7.3.190.0090.00816.55
7.3.180.0100.00616.42
7.3.170.0060.00916.52
7.3.160.0000.01616.37
7.3.120.0060.01114.94
7.3.110.0090.00615.07
7.3.100.0030.01214.89
7.3.90.0030.00814.91
7.3.80.0000.01814.68
7.3.70.0090.00614.90
7.3.60.0090.00614.57
7.3.50.0070.00714.92
7.3.40.0040.01114.92
7.3.30.0040.00814.82
7.3.20.0030.01216.57
7.3.10.0110.00416.63
7.3.00.0070.00716.63
7.2.330.0100.00716.81
7.2.320.0060.01016.79
7.2.310.0090.00916.49
7.2.300.0100.01316.69
7.2.290.0070.01416.54
7.2.250.0040.01514.98
7.2.240.0130.00714.71
7.2.230.0030.01315.22
7.2.220.0040.01115.18
7.2.210.0040.00715.25
7.2.200.0120.00315.25
7.2.190.0070.01014.98
7.2.180.0030.00815.07
7.2.170.0070.00714.96
7.2.90.0100.00716.92
7.2.80.0100.00516.54
7.2.70.0060.00916.79
7.2.60.0030.01316.55
7.2.50.0040.01116.89
7.2.40.0080.01116.78
7.2.30.0110.00316.90
7.2.20.0030.01016.75
7.2.10.0130.00716.86
7.2.00.0090.00916.89
7.1.330.0040.01115.82
7.1.320.0080.00815.80
7.1.310.0040.01115.73
7.1.300.0040.00715.82
7.1.290.0000.01415.60
7.1.280.0000.01415.82
7.1.270.0100.00315.78
7.1.260.0070.00715.90
7.1.210.0080.00815.43
7.1.200.0080.00515.58
7.1.190.0110.00315.50
7.1.180.0000.01315.71
7.1.170.0060.00815.81
7.1.160.0030.00915.54
7.1.150.0030.01015.46
7.1.140.0030.00915.80
7.1.130.0160.00015.75
7.1.120.0130.00415.75
7.1.110.0110.00615.80
7.1.100.0090.00915.79
7.1.90.0570.01513.65
7.1.80.0760.00813.84
7.1.70.0460.00613.77
7.1.60.0570.01531.86
7.1.50.0710.01231.64
7.1.40.0690.01032.00
7.1.30.0670.01631.92
7.1.20.0600.01431.83
7.1.10.0450.01013.92
7.1.00.0430.00313.93
7.0.310.0090.00415.31
7.0.300.0030.01215.39
7.0.290.0090.00315.13
7.0.280.0100.01015.30
7.0.270.0100.00315.36
7.0.260.0050.01015.45
7.0.250.0600.00715.41
7.0.240.0060.00915.36
7.0.230.0990.00713.54
7.0.220.0550.00713.44
7.0.210.0580.00613.45
7.0.200.0690.00613.44
7.0.190.0670.00313.63
7.0.180.0730.00613.67
7.0.170.0630.00613.59
7.0.160.0390.00913.17
7.0.150.0500.00713.36
7.0.140.0400.00813.11
7.0.130.0650.00713.71
7.0.120.0310.01213.48
7.0.110.0550.01413.36
7.0.100.0370.00313.59
7.0.90.0280.00513.54
7.0.80.0330.01713.23
7.0.70.0500.00313.37
7.0.60.0440.00713.50
7.0.50.0550.00313.16
7.0.40.0400.00413.46
7.0.30.0290.01613.56
7.0.20.0560.01413.33
7.0.10.0300.00613.25
7.0.00.0310.00313.48

preferences:
58.88 ms | 402 KiB | 5 Q