3v4l.org

run code in 300+ PHP versions simultaneously
<?php // i wish the php builtin HashContext class had this stuff: class OOHashContext{ private $hc; public const HASH_HMAC=1; public function __construct(string $algo, int $options = 0, string $key = NULL){ if(!($this->hc = hash_init($algo, $options, $key))){ throw new \RuntimeException(); } } public function update(string $data):self{ if(!hash_update($this->hc, $data)){ throw new \RuntimeException(); } return $this; } public function update_file(string $file, $scontext = null):self{ if(!hash_update_file($this->hc, $file, $scontext)){ throw new \RuntimeException(); } return $this; } public function update_stream($handle, int $length = -1):self{ if(!hash_update_stream($this->hc, $handle, $length)){ throw new \RuntimeException(); } return $this; } public function final(bool $raw_output = false):string{ $ret = hash_final($this->hc, $raw_output); if(!is_string($ret)){ throw new \RuntimeException(); } return $ret; } } $o=new OOHashContext("SHA1"); $str1="foo"; $str2="bar"; $result = (new OOHashContext("SHA1"))->update($str1)->update($str2)->final(); echo $result;

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.4.120.0140.00623.98
8.4.110.0040.00518.92
8.4.100.0130.00918.63
8.4.90.0150.00618.00
8.4.80.0120.00718.77
8.4.70.0060.00218.11
8.4.60.0120.00818.81
8.4.50.0090.01020.51
8.4.40.0140.00317.90
8.4.30.0060.00320.38
8.4.20.0070.01419.98
8.4.10.0130.00320.63
8.3.250.0090.00718.84
8.3.240.0120.00717.20
8.3.230.0130.00616.80
8.3.220.0110.00619.09
8.3.210.0080.00618.79
8.3.200.0050.00416.60
8.3.190.0030.00517.32
8.3.180.0050.00316.87
8.3.170.0060.01217.12
8.3.160.0090.00920.43
8.3.150.0110.00718.80
8.3.140.0000.00721.02
8.3.130.0040.00418.69
8.3.120.0090.00020.57
8.3.110.0040.00418.57
8.3.100.0090.00018.77
8.3.90.0050.00326.77
8.3.80.0090.00018.38
8.3.70.0110.00416.88
8.3.60.0040.01116.48
8.3.50.0110.00723.72
8.3.40.0110.00421.73
8.3.30.0110.00418.92
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0120.00720.34
8.2.280.0050.00318.78
8.2.270.0050.00317.19
8.2.260.0140.00016.44
8.2.250.0040.00418.45
8.2.240.0040.00418.86
8.2.230.0030.00620.94
8.2.220.0040.00424.06
8.2.210.0090.00926.77
8.2.200.0070.00316.75
8.2.190.0150.00016.58
8.2.180.0120.00925.92
8.2.170.0120.00318.76
8.2.160.0160.00022.96
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.77
8.2.110.0040.00421.03
8.2.100.0090.00317.97
8.2.90.0060.00317.88
8.2.80.0060.00318.73
8.2.70.0080.00017.93
8.2.60.0000.00918.34
8.2.50.0090.00018.10
8.2.40.0040.00419.23
8.2.30.0030.00519.29
8.2.20.0050.00217.95
8.2.10.0040.00419.44
8.2.00.0040.00419.26
8.1.330.0090.00721.98
8.1.320.0070.01116.16
8.1.310.0070.00716.89
8.1.300.0060.00318.64
8.1.290.0080.00430.84
8.1.280.0120.00325.92
8.1.270.0030.00623.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00620.70
8.1.230.0040.00820.89
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0030.00618.53
8.1.160.0040.00419.09
8.1.150.0040.00418.92
8.1.140.0000.00818.87
8.1.130.0030.00320.21
8.1.120.0060.00317.54
8.1.110.0000.00717.46
8.1.100.0030.00717.44
8.1.90.0020.00517.49
8.1.80.0040.00717.47
8.1.70.0000.00717.44
8.1.60.0030.00617.58
8.1.50.0050.00317.46
8.1.40.0050.00317.42
8.1.30.0000.00817.69
8.1.20.0050.00217.68
8.1.10.0050.00317.61
8.1.00.0000.00917.42
8.0.300.0000.00820.13
8.0.290.0070.00016.75
8.0.280.0030.00318.41
8.0.270.0070.00016.85
8.0.260.0000.00720.24
8.0.250.0040.00417.00
8.0.240.0000.00716.88
8.0.230.0000.00716.92
8.0.220.0040.00416.95
8.0.210.0000.00716.88
8.0.200.0000.00816.82
8.0.190.0040.00416.88
8.0.180.0050.00216.88
8.0.170.0000.00816.83
8.0.160.0040.00417.00
8.0.150.0040.00416.73
8.0.140.0000.01016.80
8.0.130.0030.00313.36
8.0.120.0040.00416.89
8.0.110.0050.00216.87
8.0.100.0040.00416.92
8.0.90.0030.00316.77
8.0.80.0060.01016.84
8.0.70.0030.00616.91
8.0.60.0030.00516.88
8.0.50.0050.00316.77
8.0.30.0090.00617.29
8.0.20.0110.01016.78
8.0.10.0040.00417.01
8.0.00.0070.01416.66
7.4.330.0000.00515.55
7.4.320.0030.00316.60
7.4.300.0090.00016.60
7.4.290.0000.00716.50
7.4.280.0000.00816.55
7.4.270.0000.00816.67
7.4.260.0050.00013.28
7.4.250.0030.00316.59
7.4.240.0030.00316.68
7.4.230.0020.00516.60
7.4.220.0020.00516.61
7.4.210.0090.00616.59
7.4.200.0070.00016.28
7.4.130.0080.01016.53
7.4.120.0130.00316.51
7.4.110.0110.00716.41
7.4.100.0120.00716.39
7.4.90.0060.01316.35
7.4.80.0100.00816.32
7.4.70.0040.01416.47
7.4.60.0090.00916.56
7.4.50.0110.01216.70
7.4.40.0080.01416.56
7.4.30.0080.01016.31
7.4.20.0080.00916.55
7.4.10.0080.00916.49
7.4.00.0030.01516.27
7.3.330.0040.00416.35
7.3.320.0000.00713.27
7.3.310.0000.00816.36
7.3.300.0000.00716.29
7.3.290.0060.00816.30
7.3.260.0140.00416.57
7.3.230.0110.00816.46
7.3.220.0120.00616.50
7.3.210.0070.01316.40
7.3.200.0150.00716.35
7.3.190.0060.01216.54
7.3.180.0070.01216.54
7.3.170.0070.01016.28
7.3.160.0060.01416.27
7.3.150.0150.00516.61
7.3.140.0120.00716.32
7.3.130.0110.00816.53
7.3.120.0070.01316.41
7.3.110.0120.00916.47
7.3.100.0090.00916.41
7.3.90.0100.00916.55
7.3.80.0070.01316.38
7.3.70.0130.00716.38
7.3.60.0090.01016.44
7.3.50.0110.00916.26
7.3.40.0130.00616.46
7.3.30.0140.00416.36
7.3.20.0210.01016.52
7.3.10.0160.00716.32
7.3.00.0120.01016.47
7.2.340.0080.01116.63
7.2.330.0090.01216.74
7.2.320.0050.01516.46
7.2.310.0110.01016.70
7.2.300.0110.01016.76
7.2.290.0160.00616.69
7.2.280.0140.00716.56
7.2.270.0120.00716.77
7.2.260.0070.01316.72
7.2.250.0060.01316.71
7.2.240.0100.00916.45
7.2.230.0110.00716.50
7.2.220.0080.01016.62
7.2.210.0130.00516.70
7.2.200.0120.00916.57
7.2.190.0120.00616.65
7.2.180.0130.00816.71
7.2.170.0050.01416.60
7.2.160.0080.01316.47
7.2.150.0080.01616.67
7.2.140.0080.01616.58
7.2.130.0130.01416.78
7.2.120.0100.01316.62
7.2.110.0070.00816.59
7.2.100.0100.00916.65
7.2.90.0180.00616.60
7.2.80.0090.01216.68
7.2.70.0130.01216.73
7.2.60.0080.01616.76
7.2.50.0180.00416.52
7.2.40.0150.00816.68
7.2.30.0200.00316.71
7.2.20.0160.00716.58
7.2.10.0120.01016.67
7.2.00.0120.01116.74
7.1.330.0160.00315.56
7.1.320.0200.00415.45
7.1.310.0180.00415.43
7.1.300.0090.01515.38
7.1.290.0070.01415.37
7.1.280.0170.00515.49
7.1.270.0160.00515.51
7.1.260.0140.01115.50
7.1.250.0150.00915.27
7.1.240.0090.01215.57
7.1.230.0130.01015.49
7.1.220.0190.00315.46
7.1.210.0110.01115.44
7.1.200.0130.01015.47
7.1.190.0040.01815.44
7.1.180.0140.00615.45
7.1.170.0130.00615.68
7.1.160.0090.00915.49
7.1.150.0070.01015.61
7.1.140.0110.00715.57
7.1.130.0060.01215.59
7.1.120.0080.01515.70
7.1.110.0130.00715.61
7.1.100.0090.00915.69
7.1.90.0170.00015.69
7.1.80.0120.00615.64
7.1.70.0080.01215.58
7.1.60.0140.00715.33
7.1.50.0160.00415.63
7.1.40.0180.00415.46
7.1.30.0120.00915.32
7.1.20.0150.00815.54
7.1.10.0220.00415.38
7.1.00.0090.01415.31
7.0.330.0330.00615.00
7.0.320.0230.00714.97
7.0.310.0200.00915.13
7.0.300.0160.00215.04
7.0.290.0160.00515.09
7.0.280.0140.00315.11
7.0.270.0090.01014.98
7.0.260.0110.01114.96
7.0.250.0170.01015.20
7.0.240.0100.00715.05
7.0.230.0140.00314.95
7.0.220.0000.01815.09
7.0.210.0170.00715.11
7.0.200.0180.00514.84
7.0.190.0070.01714.98
7.0.180.0150.00714.98
7.0.170.0100.01315.11
7.0.160.0210.00615.19
7.0.150.0200.00715.05
7.0.140.0280.00715.00
7.0.130.0220.01115.06
7.0.120.0260.00415.17
7.0.110.0240.00615.09
7.0.100.0240.00515.01
7.0.90.0220.00615.01
7.0.80.0230.00815.13
7.0.70.0220.00815.10
7.0.60.0240.00915.13
7.0.50.0200.00915.05
7.0.40.0220.00314.89
7.0.30.0240.00315.00
7.0.20.0240.00215.09
7.0.10.0180.01014.84
7.0.00.0240.00315.03
5.6.400.0220.01315.61
5.6.390.0150.01515.74
5.6.380.0190.01515.69
5.6.370.0140.01515.70
5.6.360.0220.00015.79
5.6.350.0120.00915.61
5.6.340.0130.01015.80
5.6.330.0120.00815.63
5.6.320.0160.00615.43
5.6.310.0110.01115.68
5.6.300.0230.01115.73
5.6.290.0120.01715.73
5.6.280.0190.01215.86
5.6.270.0160.01615.75
5.6.260.0300.00415.79
5.6.250.0210.00915.70
5.6.240.0210.00915.86
5.6.230.0240.01015.67
5.6.220.0210.01015.44
5.6.210.0260.00415.70
5.6.200.0200.01015.73
5.6.190.0110.01115.70
5.6.180.0180.01615.75
5.6.170.0220.01115.57
5.6.160.0130.01815.77
5.6.150.0260.00715.61
5.6.140.0080.02015.71
5.6.130.0210.01515.68
5.6.120.0170.01415.50
5.6.110.0110.02015.56
5.6.100.0230.00715.56
5.6.90.0310.00915.59
5.6.80.0210.00815.55
5.6.70.0210.01815.61
5.6.60.0150.01115.45
5.6.50.0150.01515.73
5.6.40.0200.01015.60
5.6.30.0190.01015.82
5.6.20.0260.00315.75
5.6.10.0180.01115.50
5.6.00.0160.01315.70
5.5.380.0270.00315.66
5.5.370.0210.01415.61
5.5.360.0240.01215.71
5.5.350.0240.00615.54
5.5.340.0160.01315.48
5.5.330.0290.00015.63
5.5.320.0220.00715.84
5.5.310.0170.01115.77
5.5.300.0170.01215.71
5.5.290.0210.00715.71
5.5.280.0200.00815.64
5.5.270.0190.01015.66
5.5.260.0240.00715.64
5.5.250.0200.01115.53
5.5.240.0260.00315.57
5.5.230.0260.00715.55
5.5.220.0180.01215.41
5.5.210.0200.01215.43
5.5.200.0060.02315.72
5.5.190.0240.00415.46
5.5.180.0220.00715.52
5.5.170.0190.01015.61
5.5.160.0200.01015.46
5.5.150.0250.01315.42
5.5.140.0190.01515.64
5.5.130.0150.01215.82
5.5.120.0160.01215.82
5.5.110.0200.01115.48
5.5.100.0240.00415.54
5.5.90.0190.01215.63
5.5.80.0140.01415.68
5.5.70.0130.01615.52
5.5.60.0180.00915.46
5.5.50.0140.01415.46
5.5.40.0150.01215.59
5.5.30.0190.00815.32
5.5.20.0140.01415.54
5.5.10.0130.01315.52
5.5.00.0190.00815.36
5.4.450.0210.00312.42
5.4.440.0160.00512.47
5.4.430.0140.00712.39
5.4.420.0140.01112.43
5.4.410.0150.00612.33
5.4.400.0190.00312.43
5.4.390.0270.00612.48
5.4.380.0180.00912.30
5.4.370.0140.00712.41
5.4.360.0130.00912.44
5.4.350.0160.00612.30
5.4.340.0160.00612.45
5.4.330.0150.00712.53
5.4.320.0110.01112.55
5.4.310.0220.00312.38
5.4.300.0150.00712.42
5.4.290.0210.00012.32
5.4.280.0130.01012.42
5.4.270.0160.01212.41
5.4.260.0190.00312.41
5.4.250.0140.00712.18
5.4.240.0160.00612.32
5.4.230.0150.00612.42
5.4.220.0160.00512.52
5.4.210.0120.01012.32
5.4.200.0130.00912.66
5.4.190.0160.00612.61
5.4.180.0120.00912.27
5.4.170.0150.00612.39
5.4.160.0130.00912.43
5.4.150.0180.00412.51
5.4.140.0140.00812.30
5.4.130.0160.00812.68
5.4.120.0190.00612.51
5.4.110.0160.00512.30
5.4.100.0240.00012.38
5.4.90.0110.01112.56
5.4.80.0130.00712.38
5.4.70.0150.00812.50
5.4.60.0140.00712.53
5.4.50.0120.00912.42
5.4.40.0130.00612.27
5.4.30.0180.00412.40
5.4.20.0120.00812.36
5.4.10.0180.00312.45
5.4.00.0140.00712.39
5.3.290.0090.01412.93
5.3.280.0120.01212.71
5.3.270.0090.01412.83
5.3.260.0130.01012.71
5.3.250.0160.00712.71
5.3.240.0090.01512.61
5.3.230.0150.01212.84
5.3.220.0230.00712.64
5.3.210.0200.01012.79
5.3.200.0220.00412.78
5.3.190.0170.00612.89
5.3.180.0110.01112.98
5.3.170.0070.01712.88
5.3.160.0090.01312.88
5.3.150.0170.00612.82
5.3.140.0160.00612.91
5.3.130.0210.00312.77
5.3.120.0160.00712.80
5.3.110.0130.01312.91
5.3.100.0090.01312.89
5.3.90.0210.00012.85
5.3.80.0120.00912.75
5.3.70.0080.01512.69
5.3.60.0180.00312.83
5.3.50.0150.00712.69
5.3.40.0190.00612.81
5.3.30.0200.01012.85
5.3.20.0190.00312.81
5.3.10.0110.01112.63
5.3.00.0120.01212.55
5.2.170.0110.00712.07
5.2.160.0070.01411.76
5.2.150.0140.00511.97
5.2.140.0070.01111.89
5.2.130.0080.01111.72
5.2.120.0100.01011.85
5.2.110.0150.00511.87
5.2.100.0190.00311.87
5.2.90.0080.01211.78
5.2.80.0140.00611.66
5.2.70.0100.00911.68
5.2.60.0170.00411.58
5.2.50.0150.00411.82
5.2.40.0080.01111.77
5.2.30.0120.00911.65
5.2.20.0100.00811.57
5.2.10.0070.01011.57
5.2.00.0150.00511.57
5.1.60.0140.00411.57
5.1.50.0130.00311.57
5.1.40.0080.00811.57
5.1.30.0120.00611.57
5.1.20.0090.00911.57
5.1.10.0100.01011.57
5.1.00.0160.00311.57
5.0.50.0090.00511.57
5.0.40.0090.00511.57
5.0.30.0050.00911.57
5.0.20.0040.00911.57
5.0.10.0080.00511.57
5.0.00.0130.00011.57
4.4.90.0110.00011.57
4.4.80.0050.00511.57
4.4.70.0060.00311.57
4.4.60.0050.00311.57
4.4.50.0000.00811.57
4.4.40.0070.00311.57
4.4.30.0100.00011.57
4.4.20.0120.00011.57
4.4.10.0050.00511.57
4.4.00.0000.00811.57
4.3.110.0000.00811.57
4.3.100.0090.00011.57
4.3.90.0080.00011.57
4.3.80.0040.00411.57
4.3.70.0060.00311.57
4.3.60.0030.00611.57
4.3.50.0030.00611.57
4.3.40.0040.00411.57
4.3.30.0080.00011.57
4.3.20.0040.00411.57
4.3.10.0080.00011.57
4.3.00.0070.00011.57

preferences:
32.1 ms | 403 KiB | 5 Q