3v4l.org

run code in 300+ PHP versions simultaneously
<?php // key which will sign the data $key = hash('sha256', 'Unique user data or Some secret'); // the data $array = [ 'foobar' => 'baz' ]; // encode the payload $json = json_encode($array); // sign it with key $token = hash_hmac('sha256', $json, $key); // set response header //header('X-Checksum: '.$token); //echo $json; ## This is how the receiver would verify the received data. // faked: this would be populated by the request/response $_POST['json'] = $json; $_SERVER['X-Checksum'] = $token; // verify the data matches token by signing the data with the key $check = hash_hmac('sha256', $_POST['json'], $key); if (hash_equals($token, $check)) { echo 'Verified'; } else { echo 'Tampered'; } // example tampered data $_POST['json'] = 'tampered'.$json; $check = hash_hmac('sha256', $_POST['json'], $key); if (hash_equals($token, $check)) { echo 'Verified'; } else { echo 'Tampered'; }

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.0120.00318.55
8.3.50.0090.00616.50
8.3.40.0090.00918.98
8.3.30.0140.00018.67
8.3.20.0040.00423.66
8.3.10.0030.00523.65
8.3.00.0040.00423.46
8.2.180.0100.01018.16
8.2.170.0040.01222.96
8.2.160.0110.00319.04
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0080.00020.82
8.2.110.0150.00421.03
8.2.100.0080.00417.84
8.2.90.0030.00619.13
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0060.00318.10
8.2.30.0090.00018.00
8.2.20.0000.00818.19
8.2.10.0000.00718.06
8.2.00.0000.00918.19
8.1.280.0040.01125.92
8.1.270.0050.00322.14
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0000.01122.80
8.1.230.0040.00817.83
8.1.220.0000.00917.78
8.1.210.0030.00718.77
8.1.200.0000.01017.35
8.1.190.0030.00517.35
8.1.180.0030.00618.10
8.1.170.0030.00818.55
8.1.160.0070.00018.89
8.1.150.0040.00418.80
8.1.140.0050.00218.98
8.1.130.0030.00317.62
8.1.120.0000.00717.35
8.1.110.0070.00017.46
8.1.100.0040.00417.46
8.1.90.0050.00317.49
8.1.80.0000.00717.41
8.1.70.0040.00417.41
8.1.60.0060.00717.53
8.1.50.0200.00417.42
8.1.40.0180.00517.48
8.1.30.0180.00517.62
8.1.20.0160.00517.66
8.1.10.0170.00517.48
8.1.00.0140.00717.45
8.0.300.0030.00518.77
8.0.290.0070.00316.75
8.0.280.0080.00018.45
8.0.270.0070.00017.25
8.0.260.0030.00317.26
8.0.250.0030.00316.87
8.0.240.0040.00416.84
8.0.230.0000.00716.81
8.0.220.0030.00316.86
8.0.210.0070.00016.77
8.0.200.0000.00616.96
8.0.190.0060.00616.95
8.0.180.0160.00216.86
8.0.170.0140.00316.81
8.0.160.0140.00516.80
8.0.150.0110.00616.81
8.0.140.0150.00316.80
8.0.130.0140.00315.63
8.0.120.0110.00716.87
8.0.110.0100.00816.84
8.0.100.0090.00916.82
8.0.90.0120.00716.79
8.0.80.0100.01016.82
8.0.70.0170.00516.83
8.0.60.0160.00716.85
8.0.50.0140.00716.85
8.0.30.0140.00716.91
8.0.20.0130.00817.17
8.0.10.0160.00816.94
8.0.00.0080.00916.90
7.4.330.0020.00215.55
7.4.320.0030.00316.49
7.4.300.0030.00316.65
7.4.290.0180.00216.52
7.4.280.0170.00216.49
7.4.270.0110.00216.45
7.4.260.0080.00716.53
7.4.250.0130.00316.52
7.4.240.0100.00616.48
7.4.230.0110.00316.53
7.4.220.0120.00516.39
7.4.210.0120.00516.50
7.4.200.0080.00916.55
7.4.190.0100.00616.55
7.4.180.0120.00716.64
7.4.160.0110.00816.53
7.4.150.0130.00916.65
7.4.140.0110.00817.10
7.4.130.0130.00716.45
7.4.120.0160.00516.52
7.4.110.0140.00716.43
7.4.100.0110.00716.47
7.4.90.0130.00816.41
7.4.80.0150.00716.87
7.4.70.0130.00716.39
7.4.60.0110.01016.45
7.4.50.0110.00916.37
7.4.40.0130.00716.38
7.4.30.0140.00616.41
7.4.20.0130.00616.41
7.4.10.0110.01016.43
7.4.00.0090.01016.31
7.3.330.0100.00715.18
7.3.320.0150.00315.15
7.3.310.0140.00416.25
7.3.300.0120.00516.27
7.3.290.0100.00816.23
7.3.280.0130.00616.22
7.3.270.0150.00616.41
7.3.260.0140.00716.23
7.3.250.0120.00816.29
7.3.240.0110.00916.27
7.3.230.0130.00716.28
7.3.220.0170.00616.19
7.3.210.0150.00816.37
7.3.200.0150.00616.25
7.3.190.0140.00916.28
7.3.180.0150.00816.26
7.3.170.0140.00716.28
7.3.160.0140.00816.38
7.3.150.0120.01016.33
7.3.140.0150.00716.36
7.3.130.0140.00916.22
7.3.120.0110.00916.28
7.3.110.0150.00716.27
7.3.100.0180.00316.04
7.3.90.0130.00716.04
7.3.80.0130.00615.94
7.3.70.0110.00915.94
7.3.60.0130.00715.94
7.3.50.0140.00615.93
7.3.40.0130.00615.96
7.3.30.0100.00915.81
7.3.20.0170.00816.21
7.3.10.0230.00716.24
7.3.00.0230.00716.29
7.2.340.0120.00816.27
7.2.330.0140.00816.40
7.2.320.0140.00916.40
7.2.310.0170.00816.43
7.2.300.0170.00716.40
7.2.290.0140.00916.47
7.2.280.0130.00916.47
7.2.270.0170.00816.45
7.2.260.0150.00916.44
7.2.250.0160.00616.42
7.2.240.0140.00816.44
7.2.230.0130.00916.16
7.2.220.0140.00816.13
7.2.210.0140.00716.01
7.2.200.0140.00816.11
7.2.190.0120.00816.08
7.2.180.0120.00916.17
7.2.170.0170.00716.10
7.2.160.0120.00815.96
7.2.150.0230.00916.40
7.2.140.0210.00816.41
7.2.130.0210.00916.51
7.2.120.0230.00816.49
7.2.110.0240.00716.48
7.2.100.0200.00816.50
7.2.90.0210.00716.47
7.2.80.0210.00816.46
7.2.70.0220.00916.36
7.2.60.0190.00816.43
7.2.50.0200.00816.44
7.2.40.0400.00816.49
7.2.30.0360.01016.44
7.2.20.0300.00816.46
7.2.10.0340.00916.41
7.2.00.0320.00916.50
7.1.330.0210.00916.20
7.1.320.0160.00815.61
7.1.310.0150.00815.58
7.1.300.0160.00715.63
7.1.290.0270.00715.60
7.1.280.0140.01115.60
7.1.270.0160.01015.47
7.1.260.0220.00615.45
7.1.250.0200.00815.42
7.1.240.0260.00815.36
7.1.230.0210.01015.37
7.1.220.0250.00715.36
7.1.210.0220.00815.32
7.1.200.0230.00915.37
7.1.190.0200.00715.35
7.1.180.0220.00915.33
7.1.170.0230.00915.29
7.1.160.0390.00815.21
7.1.150.0380.00915.26
7.1.140.0340.00815.31
7.1.130.0340.00815.33
7.1.120.0330.00915.33
7.1.110.0330.00915.31
7.1.100.0310.00915.32
7.1.90.0400.00915.27
7.1.80.0310.01015.23
7.1.70.0310.01015.14
7.1.60.0340.00818.94
7.1.50.0390.00818.95
7.1.40.0390.00918.87
7.1.30.0360.00818.88
7.1.20.0380.00718.88
7.1.10.0300.00915.11
7.1.00.0330.00815.11
7.0.330.0240.00814.79
7.0.320.0210.00714.91
7.0.310.0250.00514.97
7.0.300.0210.00714.82
7.0.290.0180.00914.84
7.0.280.0210.00714.90
7.0.270.0190.00914.96
7.0.260.0170.00914.96
7.0.250.0190.01014.99
7.0.240.0220.00815.00
7.0.230.0220.00614.94
7.0.220.0220.00814.89
7.0.210.0200.00714.87
7.0.200.0300.00814.91
7.0.190.0200.00814.90
7.0.180.0180.00814.85
7.0.170.0170.00714.82
7.0.160.0190.00814.84
7.0.150.0190.00714.79
7.0.140.0180.00914.76
7.0.130.0190.00814.83
7.0.120.0210.00914.86
7.0.110.0170.00914.88
7.0.100.0190.00914.77
7.0.90.0180.00814.74
7.0.80.0240.00614.79
7.0.70.0200.00914.79
7.0.60.0170.00914.82
7.0.50.0200.00814.82
7.0.40.0220.00914.93
7.0.30.0160.00814.89
7.0.20.0200.00714.85
7.0.10.0180.00914.85
7.0.00.0210.00614.84
5.6.400.0160.00815.35
5.6.390.0140.01115.38
5.6.380.0150.00815.18
5.6.370.0160.00815.29
5.6.360.0130.00815.39
5.6.350.0140.00815.30
5.6.340.0170.00715.37
5.6.330.0160.00815.45
5.6.320.0110.01215.35
5.6.310.0150.00915.30
5.6.300.0150.01515.86
5.6.290.0170.01315.95
5.6.280.0160.01515.93
5.6.270.0130.01715.96
5.6.260.0140.01515.93
5.6.250.0140.01515.97
5.6.240.0140.01715.93
5.6.230.0150.01415.95
5.6.220.0140.01615.99
5.6.210.0140.01415.91
5.6.200.0150.01515.96
5.6.190.0150.01615.98
5.6.180.0140.01515.95
5.6.170.0160.01515.98
5.6.160.0140.01515.98
5.6.150.0160.01415.93
5.6.140.0170.01416.00
5.6.130.0140.01515.99
5.6.120.0150.01715.92
5.6.110.0120.01815.95
5.6.100.0130.01815.96
5.6.90.0150.01515.97
5.6.80.0140.01415.79
5.6.70.0130.01615.86
5.6.60.0150.01615.80
5.6.50.0140.01415.79
5.6.40.0130.01515.81
5.6.30.0130.01815.78
5.6.20.0140.01515.78
5.6.10.0140.01815.75
5.6.00.0120.01615.81

preferences:
55.48 ms | 401 KiB | 5 Q