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 = 0x0ffffffff & ($hash * FNV_prime_32); $hash ^= ord($chr); } $hash = $hash & 0x0ffffffff; return $hash; } var_dump(fnvhash_fnv1("test")); var_dump(fnvhash_fnv1("tess"));

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.0090.00616.63
8.3.50.0100.01222.05
8.3.40.0120.00618.63
8.3.30.0070.01019.09
8.3.20.0080.00020.34
8.3.10.0080.00023.65
8.3.00.0050.00319.44
8.2.180.0150.00018.16
8.2.170.0040.01122.96
8.2.160.0140.00020.27
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0040.00419.23
8.2.110.0060.00322.16
8.2.100.0120.00317.89
8.2.90.0040.00417.75
8.2.80.0030.00718.86
8.2.70.0080.00017.50
8.2.60.0060.00317.50
8.2.50.0070.00018.05
8.2.40.0040.00419.30
8.2.30.0040.00418.34
8.2.20.0000.00717.88
8.2.10.0040.00418.17
8.2.00.0050.00217.78
8.1.280.0120.00825.92
8.1.270.0090.00024.01
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0030.00620.42
8.1.230.0000.01117.89
8.1.220.0030.00517.79
8.1.210.0000.00818.77
8.1.200.0030.00917.13
8.1.190.0000.00817.23
8.1.180.0000.00718.10
8.1.170.0000.00817.62
8.1.160.0000.00722.08
8.1.150.0040.00418.65
8.1.140.0000.00717.48
8.1.130.0040.00417.91
8.1.120.0040.00417.51
8.1.110.0030.00617.46
8.1.100.0030.00317.47
8.1.90.0020.00517.41
8.1.80.0040.00417.52
8.1.70.0030.00317.46
8.1.60.0040.00417.49
8.1.50.0030.00517.51
8.1.40.0040.00417.57
8.1.30.0000.00817.70
8.1.20.0000.00817.59
8.1.10.0000.00717.55
8.1.00.0000.00817.46
8.0.300.0000.00718.81
8.0.290.0070.00016.88
8.0.280.0030.00318.47
8.0.270.0030.00317.20
8.0.260.0040.00417.25
8.0.250.0070.00016.93
8.0.240.0060.00316.94
8.0.230.0070.00017.05
8.0.220.0030.00316.81
8.0.210.0030.00316.94
8.0.200.0000.00616.90
8.0.190.0070.00017.00
8.0.180.0000.00816.95
8.0.170.0030.00516.85
8.0.160.0040.00416.89
8.0.150.0040.00416.90
8.0.140.0000.00816.87
8.0.130.0000.00513.34
8.0.120.0050.00316.90
8.0.110.0000.00716.82
8.0.100.0040.00416.86
8.0.90.0000.00716.93
8.0.80.0070.00716.91
8.0.70.0070.00016.94
8.0.60.0000.00716.82
8.0.50.0050.00316.69
8.0.30.0100.00717.06
8.0.20.0060.01317.40
8.0.10.0000.00716.97
8.0.00.0090.01116.91
7.4.330.0000.00615.00
7.4.320.0030.00316.54
7.4.300.0060.00316.65
7.4.290.0050.00316.54
7.4.280.0090.00016.46
7.4.270.0040.00416.47
7.4.260.0000.00716.58
7.4.250.0040.00416.55
7.4.240.0000.00716.63
7.4.230.0000.00716.43
7.4.220.0060.01416.59
7.4.210.0140.00016.60
7.4.200.0040.00416.73
7.4.160.0060.00916.44
7.4.150.0060.01317.40
7.4.140.0060.01117.86
7.4.130.0050.01416.57
7.4.120.0060.01216.51
7.4.110.0100.00716.65
7.4.100.0070.01716.58
7.4.90.0070.01116.43
7.4.80.0030.01719.39
7.4.70.0090.00916.76
7.4.60.0030.01316.38
7.4.50.0040.00416.58
7.4.40.0080.00816.75
7.4.30.0130.00316.43
7.4.00.0110.00314.82
7.3.330.0050.00013.33
7.3.320.0000.00613.28
7.3.310.0000.00616.29
7.3.300.0060.00016.33
7.3.290.0060.01316.40
7.3.280.0100.00916.31
7.3.270.0060.01217.40
7.3.260.0150.00716.32
7.3.250.0120.01016.53
7.3.240.0110.00716.40
7.3.230.0100.00716.47
7.3.210.0090.00916.55
7.3.200.0080.00819.39
7.3.190.0100.00616.64
7.3.180.0110.00416.35
7.3.170.0030.01316.53
7.3.160.0070.01016.46
7.3.120.0160.00015.12
7.2.330.0070.01116.76
7.2.320.0070.01016.68
7.2.310.0100.00716.54
7.2.300.0130.00316.72
7.2.290.0030.01316.72
7.2.80.0120.00316.55
7.2.60.0000.01517.07
7.1.200.0040.00715.94
7.1.70.0040.00717.26
7.1.60.0100.01319.70
7.1.50.0280.01134.89
7.1.00.0070.07322.45
7.0.200.0080.00416.72
7.0.140.0030.07322.21
7.0.60.0130.07319.87
7.0.50.0070.04717.80
7.0.40.0170.07720.11
7.0.30.0330.07020.08
7.0.20.0370.07020.33
7.0.10.0070.06020.19
7.0.00.0030.04020.19
5.6.280.0070.07021.00
5.6.210.0100.07320.55
5.6.200.0070.08018.19
5.6.190.0070.04020.59
5.6.180.3800.04020.48
5.6.170.0400.07020.71
5.6.160.0000.04720.54
5.6.150.0070.08018.23
5.6.140.0070.08318.18
5.6.130.0000.06018.27
5.6.120.0070.08720.99
5.6.110.0100.06321.00
5.6.100.0070.08021.03
5.6.90.0070.04320.98
5.6.80.0100.07720.41
5.6.70.0000.06320.47
5.5.350.0170.05320.49
5.5.340.0030.08718.09
5.5.330.0030.08720.27
5.5.320.0200.05320.25
5.5.310.0230.04320.19
5.5.300.0000.04018.07
5.5.290.0070.08317.92
5.5.280.0000.04320.80
5.5.270.0070.08020.68
5.5.260.0070.03720.76
5.5.250.0100.03320.66
5.5.240.0300.07320.16
5.4.450.0370.04743.90
5.4.440.0100.04319.42
5.4.430.0270.04043.79
5.4.420.0400.04343.78
5.4.410.0330.03743.77
5.4.400.0200.04043.77
5.4.390.0500.03743.77
5.4.380.0170.05318.72
5.4.370.0130.05018.55
5.4.360.0070.05718.61
5.4.350.0170.05018.73
5.4.340.0170.04718.53
5.4.320.0080.03412.50
5.4.310.0040.04112.50
5.4.300.0070.03812.50
5.4.290.0050.04112.50
5.4.280.0070.03312.40
5.4.270.0050.03712.40
5.4.260.0040.04012.40
5.4.250.0080.03812.40
5.4.240.0070.03812.40
5.4.230.0120.03512.39
5.4.220.0060.03512.39
5.4.210.0050.03512.39
5.4.200.0090.04012.39
5.4.190.0050.04012.39
5.4.180.0030.03712.39
5.4.170.0090.03212.39
5.4.160.0050.03712.39
5.4.150.0070.03312.39
5.4.140.0090.03312.07
5.4.130.0060.03812.06
5.4.120.0040.03712.02
5.4.110.0060.03412.01
5.4.100.0060.03912.01
5.4.90.0050.03612.01
5.4.80.0090.03312.01
5.4.70.0070.03212.01
5.4.60.0020.03712.01
5.4.50.0050.03512.01
5.4.40.0030.03812.00
5.4.30.0070.03412.00
5.4.20.0050.03511.99
5.4.10.0060.03311.99
5.4.00.0050.04511.48
5.3.290.0090.03812.80
5.3.280.0070.04312.71
5.3.270.0090.03912.73
5.3.260.0120.03412.72
5.3.250.0110.03312.71
5.3.240.0050.03712.72
5.3.230.0050.03812.71
5.3.220.0040.03812.68
5.3.210.0070.03712.68
5.3.200.0060.03612.68
5.3.190.0080.03412.68
5.3.180.0090.03712.67
5.3.170.0100.03612.67
5.3.160.0060.03712.67
5.3.150.0060.04912.67
5.3.140.0110.03912.66
5.3.130.0060.04012.66
5.3.120.0070.03912.65
5.3.110.0080.03612.66
5.3.100.0060.03612.12
5.3.90.0060.03612.10
5.3.80.0050.03812.09
5.3.70.0080.03312.09
5.3.60.0070.03512.07
5.3.50.0070.03412.02
5.3.40.0080.04312.02
5.3.30.0040.04411.99
5.3.20.0070.03311.77
5.3.10.0070.04111.73
5.3.00.0050.04211.72
5.2.170.0060.0289.23
5.2.160.0030.0309.22
5.2.150.0090.0319.23
5.2.140.0030.0329.22
5.2.130.0020.0319.18
5.2.120.0090.0239.18
5.2.110.0050.0289.18
5.2.100.0050.0369.18
5.2.90.0050.0329.18
5.2.80.0070.0419.18
5.2.70.0030.0319.17
5.2.60.0050.0309.14
5.2.50.0080.0319.10
5.2.40.0040.0389.08
5.2.30.0050.0409.05
5.2.20.0050.0299.04
5.2.10.0070.0378.94
5.2.00.0050.0338.81
5.1.60.0080.0298.09
5.1.50.0070.0248.09
5.1.40.0040.0258.07
5.1.30.0060.0248.41
5.1.20.0060.0248.45
5.1.10.0050.0298.17
5.1.00.0070.0308.16
5.0.50.0060.0226.64
5.0.40.0020.0206.50
5.0.30.0030.0326.32
5.0.20.0030.0206.30
5.0.10.0050.0186.29
5.0.00.0060.0286.27
4.4.90.0010.0174.78
4.4.80.0010.0174.75
4.4.70.0030.0154.75
4.4.60.0020.0164.76
4.4.50.0020.0164.77
4.4.40.0030.0254.70
4.4.30.0040.0144.75
4.4.20.0030.0154.84
4.4.10.0050.0164.85
4.4.00.0020.0264.76
4.3.110.0030.0154.67
4.3.100.0030.0204.66
4.3.90.0040.0194.63
4.3.80.0060.0254.58
4.3.70.0050.0144.63
4.3.60.0020.0154.63
4.3.50.0030.0164.63
4.3.40.0040.0234.54
4.3.30.0020.0263.33
4.3.20.0020.0203.30
4.3.10.0020.0213.27
4.3.00.0130.01343.77

preferences:
53.01 ms | 401 KiB | 5 Q