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-CND4","direct-token":"eyJkbmEiOiJjMWRkMzliYTY4YjY0MjlkOTRmNTQzM2YwMTFiNTRlZiIsImlwIjoiMTcyLjIxLjExMi4xNjEiLCJkZiI6IjJmOTExZjdkOTgyZDQzMDY4YTNmYjc2MWRlZWQzZjI1In0=","notify-url":"https://virtual-store.com/notifications/","test-mode":0,"payment-group":"credit_card","country":"BR","language":"en-US"},"payer":{"name":"Payer Pagador","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.0160.00618.56
8.3.50.0060.00916.75
8.3.40.0110.00418.82
8.3.30.0120.00318.79
8.3.20.0090.00020.20
8.3.10.0070.01123.70
8.3.00.0000.00819.81
8.2.180.0100.01016.88
8.2.170.0030.01722.96
8.2.160.0120.00319.25
8.2.150.0050.00324.18
8.2.140.0070.01124.66
8.2.130.0040.00421.12
8.2.120.0040.00426.35
8.2.110.0090.00020.25
8.2.100.0060.00618.03
8.2.90.0080.00019.40
8.2.80.0060.00317.97
8.2.70.0040.00417.63
8.2.60.0040.00418.03
8.2.50.0030.00518.10
8.2.40.0040.00420.42
8.2.30.0080.00021.08
8.2.20.0080.00018.04
8.2.10.0070.00018.07
8.2.00.0050.00318.06
8.1.280.0180.00325.92
8.1.270.0090.00923.83
8.1.260.0000.01826.35
8.1.250.0100.00728.09
8.1.240.0080.00322.09
8.1.230.0070.00419.16
8.1.220.0060.00317.80
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0080.00017.35
8.1.180.0030.00518.10
8.1.170.0050.00318.49
8.1.160.0000.00718.99
8.1.150.0050.00320.67
8.1.140.0000.00719.52
8.1.130.0030.00318.76
8.1.120.0030.00617.46
8.1.110.0040.00417.44
8.1.100.0000.00717.50
8.1.90.0000.00817.44
8.1.80.0040.00417.39
8.1.70.0070.00017.47
8.1.60.0080.00017.53
8.1.50.0030.00617.57
8.1.40.0000.00817.52
8.1.30.0040.00417.57
8.1.20.0000.00717.71
8.1.10.0040.00417.61
8.1.00.0000.00817.51
8.0.300.0040.00418.77
8.0.290.0080.00016.63
8.0.280.0070.00018.47
8.0.270.0000.00717.27
8.0.260.0000.00716.78
8.0.250.0030.00316.88
8.0.240.0000.00816.93
8.0.230.0000.00716.88
8.0.220.0050.00316.85
8.0.210.0080.00016.80
8.0.200.0030.00316.89
8.0.190.0030.00716.83
8.0.180.0070.00016.92
8.0.170.0050.00316.83
8.0.160.0040.00416.97
8.0.150.0030.00316.74
8.0.140.0000.00716.89
8.0.130.0000.00613.37
8.0.120.0000.00716.83
8.0.110.0040.00416.88
8.0.100.0040.00416.94
8.0.90.0000.00716.74
8.0.80.0190.00016.83
8.0.70.0000.00816.76
8.0.60.0070.00016.80
8.0.50.0070.00016.73
8.0.30.0080.00917.09
8.0.20.0130.00917.40
8.0.10.0040.00416.98
8.0.00.0150.00416.86
7.4.330.0050.00015.55
7.4.320.0000.00616.45
7.4.300.0000.00616.48
7.4.290.0000.00816.57
7.4.280.0030.00616.52
7.4.270.0040.00416.42
7.4.260.0000.00816.41
7.4.250.0030.00516.54
7.4.240.0000.00816.52
7.4.230.0030.00316.69
7.4.220.0100.01716.63
7.4.210.0090.00616.63
7.4.200.0070.00016.38
7.4.160.0030.01516.49
7.4.150.0090.01617.40
7.4.140.0110.01017.86
7.4.130.0150.00416.50
7.4.120.0090.01416.43
7.4.110.0120.00616.27
7.4.100.0120.00916.47
7.4.90.0140.00316.52
7.4.80.0140.00919.39
7.4.70.0120.00616.54
7.4.60.0090.00616.55
7.4.50.0030.01216.39
7.4.40.0110.00716.65
7.4.30.0090.00916.49
7.4.00.0060.00614.85
7.3.330.0060.00013.33
7.3.320.0000.00513.18
7.3.310.0070.00016.36
7.3.300.0070.00016.30
7.3.290.0060.01016.31
7.3.280.0100.00716.31
7.3.270.0070.01017.40
7.3.260.0110.00916.53
7.3.250.0100.00716.40
7.3.240.0090.01216.36
7.3.230.0030.01316.50
7.3.210.0150.00316.32
7.3.200.0030.01416.40
7.3.190.0000.01616.40
7.3.180.0090.00616.39
7.3.170.0090.01116.54
7.3.160.0100.00616.35
7.2.330.0040.01316.70
7.2.320.0110.01116.53
7.2.310.0160.00316.51
7.2.300.0120.00616.66
7.2.290.0140.00516.56
7.2.90.0250.00414.82
7.2.80.0280.00714.53
7.2.70.0080.00815.30
7.2.60.0350.01015.18
7.2.50.0400.01214.94
7.2.40.0390.00415.01
7.2.30.0360.00615.01
7.2.20.0180.00914.98
7.2.10.0180.00315.10
7.2.00.0130.00214.85
7.1.210.0580.01114.05
7.1.200.0480.00313.89
7.1.190.0780.00713.91
7.1.180.0380.00413.69
7.1.170.0160.01314.05
7.1.160.0130.00613.88
7.1.150.0300.00713.77
7.1.140.0100.00714.04
7.1.130.0070.01013.81
7.1.120.0340.00613.56
7.1.110.0630.01013.68
7.1.100.0150.01014.05
7.1.90.0220.01014.05
7.1.80.0350.00713.77
7.1.70.0400.01713.71
7.1.60.0280.01432.02
7.1.50.0610.00331.94
7.1.40.0540.00931.79
7.1.30.0350.00631.92
7.1.20.0430.00731.74
7.1.10.0320.00913.95
7.1.00.0510.00313.88
7.0.310.0480.00313.50
7.0.300.0380.00313.18
7.0.290.0130.00313.46
7.0.280.0260.00613.33
7.0.270.0310.01013.59
7.0.260.0090.00513.54
7.0.250.0000.01813.48
7.0.240.0090.00913.55
7.0.230.0250.00313.70
7.0.220.0430.00413.42
7.0.210.0280.01313.33
7.0.200.0790.00313.46
7.0.190.0320.00613.57
7.0.180.0400.00713.59
7.0.170.0600.00613.36
7.0.160.0240.00313.43
7.0.150.0410.00313.61
7.0.140.0550.00013.74
7.0.130.0140.00413.33
7.0.120.0260.00913.63
7.0.110.0030.00913.62
7.0.100.0200.00413.49
7.0.90.0040.00713.36
7.0.80.0060.00613.55
7.0.70.0700.00413.69
7.0.60.0110.00313.61
7.0.50.0110.00713.49
7.0.40.0210.00313.34
7.0.30.0140.00513.52
7.0.20.0090.00913.44
7.0.10.0170.00613.64
7.0.00.0090.00513.42

preferences:
47.27 ms | 401 KiB | 5 Q