3v4l.org

run code in 300+ PHP versions simultaneously
<?php define ("FNV_prime_32", 16777619); define ("FNV_prime_64", 1099511628211); define ("FNV_prime_128", 309485009821345068724781371); define ("FNV_offset_basis_32", 2166136261); define ("FNV_offset_basis_64", 14695981039346656037); define ("FNV_offset_basis_128", 144066263297769815596495629667062367629); /* * The core of the FNV-1 hash algorithm is as follows: * * hash = offset_basis * for each octet_of_data to be hashed * hash = hash * FNV_prime * hash = hash xor octet_of_data * return hash * * Source: http://www.isthe.com/chongo/tech/comp/fnv/ */ /* * Example Java implementation: * * long fnv(byte[] buf, int offset, int len, long seed) * { * for (int i = offset; i < offset + len; i++) * { * seed += (seed << 1) + (seed << 4) + (seed << 7) + (seed << 8) + (seed << 24); * seed ^= buf[i]; * } * return seed; * } * * `Source: http://www.getopt.org/ - FNV1 Hash */ function fnvhash_fnv1($txt) { $buf = str_split($txt); $hash = FNV_offset_basis_32; foreach ($buf as $chr) { $hash += ($hash << 1) + ($hash << 4) + ($hash << 7) + ($hash << 8) + ($hash << 24); $hash = $hash ^ ord($chr); } $hash = $hash & 0x0ffffffff; return $hash; } var_dump(fnvhash_fnv1("te")); var_dump(fnvhash_fnv1("td"));

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.0100.01016.63
8.3.50.0120.00322.05
8.3.40.0040.01118.67
8.3.30.0180.00418.77
8.3.20.0070.00020.16
8.3.10.0050.00323.61
8.3.00.0030.00619.68
8.2.180.0120.00616.63
8.2.170.0180.00322.96
8.2.160.0100.00720.52
8.2.150.0070.00024.18
8.2.140.0100.00024.66
8.2.130.0000.00726.16
8.2.120.0090.00619.36
8.2.110.0060.00322.25
8.2.100.0110.00018.34
8.2.90.0060.00319.16
8.2.80.0000.00817.97
8.2.70.0060.00317.50
8.2.60.0000.00917.91
8.2.50.0040.00418.07
8.2.40.0040.00418.34
8.2.30.0040.00418.22
8.2.20.0000.00817.87
8.2.10.0000.00718.18
8.2.00.0040.00417.88
8.1.280.0170.00425.92
8.1.270.0040.00423.72
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0070.00322.01
8.1.230.0080.00418.97
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0000.00817.25
8.1.180.0080.00018.10
8.1.170.0000.00818.68
8.1.160.0000.00821.90
8.1.150.0040.00418.61
8.1.140.0000.00817.53
8.1.130.0040.00417.84
8.1.120.0040.00417.38
8.1.110.0060.00317.44
8.1.100.0080.00017.48
8.1.90.0000.00817.44
8.1.80.0050.00217.48
8.1.70.0000.00717.45
8.1.60.0000.00817.66
8.1.50.0000.00817.56
8.1.40.0040.00417.41
8.1.30.0000.00817.60
8.1.20.0050.00317.60
8.1.10.0000.00717.30
8.1.00.0000.00817.30
8.0.300.0070.00018.77
8.0.290.0000.00916.75
8.0.280.0030.00318.46
8.0.270.0070.00017.27
8.0.260.0060.00017.20
8.0.250.0030.00316.87
8.0.240.0000.00716.87
8.0.230.0080.00016.90
8.0.220.0030.00516.98
8.0.210.0030.00316.86
8.0.200.0030.00616.98
8.0.190.0040.00416.85
8.0.180.0040.00416.82
8.0.170.0050.00316.86
8.0.160.0020.00516.86
8.0.150.0030.00316.83
8.0.140.0050.00216.79
8.0.130.0030.00313.33
8.0.120.0030.00616.86
8.0.110.0040.00416.86
8.0.100.0040.00416.72
8.0.90.0040.00416.98
8.0.80.0080.00716.90
8.0.70.0000.00716.90
8.0.60.0070.00016.78
8.0.50.0040.00416.95
8.0.30.0140.00617.01
8.0.20.0110.00917.40
8.0.10.0070.00016.89
8.0.00.0070.01016.70
7.4.330.0050.00015.00
7.4.320.0030.00316.61
7.4.300.0070.00016.50
7.4.290.0000.00716.63
7.4.280.0060.00316.43
7.4.270.0000.00716.51
7.4.260.0030.00316.65
7.4.250.0000.00716.50
7.4.240.0020.00516.53
7.4.230.0000.00716.52
7.4.220.0210.00016.50
7.4.210.0070.00716.71
7.4.200.0020.00516.71
7.4.160.0060.00916.65
7.4.150.0070.01017.40
7.4.140.0080.01217.86
7.4.130.0100.01016.66
7.4.120.0120.00416.43
7.4.110.0130.00916.59
7.4.100.0170.00716.39
7.4.90.0130.00316.48
7.4.80.0170.00719.39
7.4.70.0100.00616.56
7.4.60.0090.00616.50
7.4.50.0000.00516.39
7.4.40.0090.00916.39
7.4.30.0120.00416.68
7.4.00.0040.01115.13
7.3.330.0000.00513.35
7.3.320.0030.00313.11
7.3.310.0000.00616.18
7.3.300.0050.00216.33
7.3.290.0110.01116.35
7.3.280.0100.01016.33
7.3.270.0000.01717.40
7.3.260.0140.00916.50
7.3.250.0050.01216.53
7.3.240.0100.00716.59
7.3.230.0100.00716.43
7.3.210.0120.00616.64
7.3.200.0100.01019.39
7.3.190.0100.00616.55
7.3.180.0090.00616.46
7.3.170.0070.01016.27
7.3.160.0030.01316.61
7.3.120.0000.01515.05
7.3.10.0030.01016.68
7.3.00.0030.01116.49
7.2.330.0090.00916.68
7.2.320.0040.01516.51
7.2.310.0110.01116.53
7.2.300.0130.00316.75
7.2.290.0130.00316.68
7.2.130.0070.00716.70
7.2.120.0110.00416.95
7.2.110.0070.00716.85
7.2.100.0060.00616.73
7.2.90.0070.00716.93
7.2.80.0060.01017.03
7.2.70.0060.00616.89
7.2.60.0090.00616.90
7.2.50.0070.01016.97
7.2.40.0000.01616.90
7.2.30.0070.01017.09
7.2.20.0030.01316.73
7.2.10.0070.00316.93
7.2.00.0030.00916.94
7.1.250.0000.01115.83
7.1.200.0030.01215.61
7.1.70.0050.00517.01
7.1.60.0130.00619.70
7.1.50.0200.01734.76
7.1.00.0000.08022.45
7.0.200.0070.00416.64
7.0.140.0100.06722.15
7.0.60.0130.06320.04
7.0.50.0030.08317.80
7.0.40.0030.09020.02
7.0.30.0530.03320.24
7.0.20.0270.06320.19
7.0.10.0030.04720.30
7.0.00.0070.06320.27
5.6.280.0130.06321.13
5.6.210.0030.08320.67
5.6.200.0130.07318.19
5.6.190.0070.04020.47
5.6.180.3800.03720.60
5.6.170.0270.08320.62
5.6.160.0100.07020.55
5.6.150.0070.09018.14
5.6.140.0070.04718.15
5.6.130.0100.08318.15
5.6.120.0130.07721.14
5.6.110.0130.08020.97
5.6.100.0230.06721.14
5.6.90.0070.06020.88
5.6.80.0230.06320.26
5.6.70.2270.03320.45
5.5.350.0000.08320.34
5.5.340.0000.06717.98
5.5.330.0070.06320.21
5.5.320.0230.04720.23
5.5.310.0270.06020.41
5.5.300.0100.05717.95
5.5.290.0030.08718.04
5.5.280.0030.04720.90
5.5.270.0100.05020.79
5.5.260.0130.08320.79
5.5.250.0130.07720.71
5.5.240.0230.04720.15
5.4.450.0530.05043.90
5.4.440.0230.04043.87
5.4.430.0130.05043.79
5.4.420.0330.04043.79
5.4.410.0130.04343.77
5.4.400.0170.04043.77
5.4.390.0200.04343.77
5.4.380.0130.05318.77
5.4.370.0170.05018.61
5.4.360.0070.05718.47
5.4.350.0100.05718.72
5.4.340.0200.05018.74
5.4.320.0030.04112.51
5.4.310.0090.03612.50
5.4.300.0080.03912.50
5.4.290.0050.03912.50
5.4.280.0060.03412.39
5.4.270.0050.03712.39
5.4.260.0060.03712.40
5.4.250.0060.04312.40
5.4.240.0040.03812.40
5.4.230.0110.03312.39
5.4.220.0040.03812.39
5.4.210.0030.03712.39
5.4.200.0050.03812.39
5.4.190.0090.03512.39
5.4.180.0030.03812.39
5.4.170.0050.03612.40
5.4.160.0080.03412.39
5.4.150.0090.03312.39
5.4.140.0050.03812.07
5.4.130.0050.03612.05
5.4.120.0050.03512.02
5.4.110.0060.03512.02
5.4.100.0040.03612.01
5.4.90.0060.04312.01
5.4.80.0040.04112.01
5.4.70.0050.04012.01
5.4.60.0060.03412.01
5.4.50.0080.03412.01
5.4.40.0040.03612.00
5.4.30.0060.03511.99
5.4.20.0060.03611.99
5.4.10.0040.03611.99
5.4.00.0050.03711.48
5.3.290.0110.03512.80
5.3.280.0040.04112.71
5.3.270.0060.04112.72
5.3.260.0080.03712.72
5.3.250.0080.03512.71
5.3.240.0040.03812.72
5.3.230.0060.03812.71
5.3.220.0070.03712.68
5.3.210.0050.04412.68
5.3.200.0070.03612.68
5.3.190.0040.04012.67
5.3.180.0020.04212.67
5.3.170.0090.03412.67
5.3.160.0080.03612.67
5.3.150.0060.04512.68
5.3.140.0070.04112.66
5.3.130.0040.04112.65
5.3.120.0060.03912.66
5.3.110.0040.04112.65
5.3.100.0060.03812.12
5.3.90.0100.03312.10
5.3.80.0060.03612.09
5.3.70.0060.03512.09
5.3.60.0030.04212.07
5.3.50.0040.03912.02
5.3.40.0060.04012.02
5.3.30.0050.03511.98
5.3.20.0060.03511.77
5.3.10.0090.03211.73
5.3.00.0080.03911.72
5.2.170.0060.0299.22
5.2.160.0090.0259.22
5.2.150.0050.0309.22
5.2.140.0010.0359.22
5.2.130.0050.0289.18
5.2.120.0100.0299.18
5.2.110.0080.0369.18
5.2.100.0040.0289.18
5.2.90.0040.0339.18
5.2.80.0020.0339.17
5.2.70.0030.0359.18
5.2.60.0070.0289.14
5.2.50.0040.0349.11
5.2.40.0030.0319.08
5.2.30.0080.0279.05
5.2.20.0030.0319.04
5.2.10.0050.0298.94
5.2.00.0080.0278.80
5.1.60.0060.0238.09
5.1.50.0040.0268.09
5.1.40.0060.0238.07
5.1.30.0060.0298.42
5.1.20.0030.0288.44
5.1.10.0070.0238.16
5.1.00.0040.0268.17
5.0.50.0040.0206.64
5.0.40.0040.0186.50
5.0.30.0030.0326.32
5.0.20.0050.0186.30
5.0.10.0040.0206.28
5.0.00.0040.0316.28
4.4.90.0020.0174.78
4.4.80.0020.0164.76
4.4.70.0040.0154.75
4.4.60.0030.0154.76
4.4.50.0010.0174.77
4.4.40.0020.0264.71
4.4.30.0020.0164.76
4.4.20.0030.0154.84
4.4.10.0010.0174.85
4.4.00.0040.0234.75
4.3.110.0030.0164.67
4.3.100.0050.0144.67
4.3.90.0040.0154.63
4.3.80.0040.0244.58
4.3.70.0060.0124.63
4.3.60.0040.0154.63
4.3.50.0020.0304.63
4.3.40.0040.0354.54
4.3.30.0060.0173.33
4.3.20.0010.0183.31
4.3.10.0030.0163.27
4.3.00.0130.01343.77

preferences:
41.57 ms | 401 KiB | 5 Q