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("t")); var_dump(fnvhash_fnv1("s"));

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.0000.01416.88
8.3.50.0070.00718.18
8.3.40.0110.00418.67
8.3.30.0100.01019.09
8.3.20.0080.00020.30
8.3.10.0000.00723.48
8.3.00.0000.00819.79
8.2.180.0150.00016.50
8.2.170.0060.00922.96
8.2.160.0100.00320.39
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00519.48
8.2.110.0000.01020.41
8.2.100.0130.00017.72
8.2.90.0040.00419.25
8.2.80.0030.00617.97
8.2.70.0050.00317.63
8.2.60.0050.00518.04
8.2.50.0000.00818.07
8.2.40.0000.01019.95
8.2.30.0070.00018.31
8.2.20.0040.00417.82
8.2.10.0000.00718.01
8.2.00.0000.00817.77
8.1.270.0080.00023.97
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0030.00623.98
8.1.230.0080.00417.64
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0090.00017.35
8.1.190.0040.00417.10
8.1.180.0030.00518.10
8.1.170.0030.00518.50
8.1.160.0030.00322.02
8.1.150.0040.00418.64
8.1.140.0040.00417.39
8.1.130.0000.00817.73
8.1.120.0040.00417.48
8.1.110.0000.01017.48
8.1.100.0030.00317.38
8.1.90.0030.00317.35
8.1.80.0000.00817.48
8.1.70.0000.00717.43
8.1.60.0000.00917.57
8.1.50.0060.00317.48
8.1.40.0040.00417.55
8.1.30.0050.00317.60
8.1.20.0000.00717.68
8.1.10.0000.00817.38
8.1.00.0040.00417.42
8.0.300.0020.00518.77
8.0.290.0040.00416.75
8.0.280.0000.00818.33
8.0.270.0040.00416.85
8.0.260.0000.00617.18
8.0.250.0030.00316.85
8.0.240.0040.00416.93
8.0.230.0000.00816.84
8.0.220.0080.00016.94
8.0.210.0030.00316.89
8.0.200.0000.00916.86
8.0.190.0040.00417.00
8.0.180.0000.00716.84
8.0.170.0030.00616.94
8.0.160.0070.00016.91
8.0.150.0000.00816.70
8.0.140.0070.00016.78
8.0.130.0060.00013.28
8.0.120.0080.00016.82
8.0.110.0000.00816.74
8.0.100.0000.00716.84
8.0.90.0080.00016.71
8.0.80.0060.00916.89
8.0.70.0050.00316.91
8.0.60.0030.00517.02
8.0.50.0000.00816.86
8.0.30.0100.01216.96
8.0.20.0070.01217.40
8.0.10.0030.00516.92
8.0.00.0120.00716.78
7.4.330.0000.00615.15
7.4.320.0070.00016.44
7.4.300.0030.00616.44
7.4.290.0000.00716.41
7.4.280.0090.00016.61
7.4.270.0000.00716.65
7.4.260.0030.00616.60
7.4.250.0080.00016.54
7.4.240.0030.00316.54
7.4.230.0000.00716.32
7.4.220.0090.00916.73
7.4.210.0110.00316.63
7.4.200.0040.00416.63
7.4.160.0140.00316.33
7.4.150.0070.01117.40
7.4.140.0110.01017.86
7.4.130.0050.01216.45
7.4.120.0100.00716.53
7.4.110.0120.01116.70
7.4.100.0110.00616.55
7.4.90.0030.01316.65
7.4.80.0100.01019.39
7.4.70.0070.01016.59
7.4.60.0120.00316.44
7.4.50.0030.00316.48
7.4.40.0070.01016.21
7.4.30.0110.00716.52
7.4.10.0130.00314.81
7.4.00.0060.00814.79
7.3.330.0030.00313.14
7.3.320.0020.00213.19
7.3.310.0060.00016.22
7.3.300.0000.00716.23
7.3.290.0030.00316.30
7.3.280.0110.00716.27
7.3.270.0110.00717.40
7.3.260.0240.01516.43
7.3.250.0110.00816.47
7.3.240.0070.01016.48
7.3.230.0100.00716.49
7.3.210.0070.01016.25
7.3.200.0100.00719.39
7.3.190.0070.01016.70
7.3.180.0090.00616.34
7.3.170.0130.00616.38
7.3.160.0030.01416.41
7.3.130.0030.01514.59
7.3.120.0050.01114.87
7.3.110.0100.00715.11
7.3.100.0090.00614.72
7.3.90.0130.00014.82
7.3.80.0040.01114.80
7.3.70.0040.01114.92
7.3.60.0110.00314.99
7.3.50.0090.00614.88
7.3.40.0080.00814.79
7.3.30.0000.01114.89
7.3.20.0100.00616.80
7.3.10.0100.00316.67
7.3.00.0080.00416.48
7.2.330.0000.01716.71
7.2.320.0110.00716.76
7.2.310.0100.01316.63
7.2.300.0100.00516.34
7.2.290.0100.00716.55
7.2.260.0030.01414.98
7.2.250.0060.00615.05
7.2.240.0060.00915.28
7.2.230.0040.01115.20
7.2.220.0030.00715.18
7.2.210.0040.01114.86
7.2.200.0000.01315.05
7.2.190.0030.00615.09
7.2.180.0030.00915.00
7.2.170.0040.01114.85
7.2.160.0000.01115.02
7.2.150.0030.01416.67
7.2.140.0060.00616.83
7.2.130.0070.00616.84
7.2.120.0090.00216.78
7.2.110.0040.01316.88
7.2.100.0090.00616.90
7.2.90.0060.00716.89
7.2.80.0100.00816.85
7.2.70.0070.00716.83
7.2.60.0120.00716.85
7.2.50.0070.01216.98
7.2.40.0080.00716.74
7.2.30.0070.00816.94
7.2.20.0090.00616.89
7.2.10.0080.00816.97
7.2.00.0030.01017.68
7.1.330.0030.01315.55
7.1.320.0030.00715.71
7.1.310.0030.01015.79
7.1.300.0030.01015.69
7.1.290.0040.01115.77
7.1.280.0070.00715.79
7.1.270.0040.00715.69
7.1.260.0060.00615.88
7.1.250.0060.00715.75
7.1.240.0070.01015.76
7.1.230.0040.00415.87
7.1.220.0030.00815.86
7.1.210.0100.00615.75
7.1.200.0150.00615.77
7.1.190.0040.00415.82
7.1.180.0070.01015.85
7.1.170.0090.00615.73
7.1.160.0060.00615.81
7.1.150.0070.00315.64
7.1.140.0090.00615.70
7.1.130.0070.00315.70
7.1.120.0000.00815.77
7.1.110.0120.00015.86
7.1.100.0040.00616.95
7.1.90.0040.01215.90
7.1.80.0040.00415.62
7.1.70.0020.01016.48
7.1.60.0120.00817.62
7.1.50.0170.00825.32
7.1.40.0090.00315.46
7.1.30.0080.00615.78
7.1.20.0060.00915.64
7.1.10.0000.01515.70
7.1.00.0050.04219.02
7.0.330.0030.00615.32
7.0.320.0030.00615.38
7.0.310.0060.00915.11
7.0.300.0040.01115.14
7.0.290.0060.00615.16
7.0.280.0070.00715.40
7.0.270.0080.00415.18
7.0.260.0070.00315.48
7.0.250.0080.00315.40
7.0.240.0040.01115.46
7.0.230.0050.00515.35
7.0.220.0090.00615.35
7.0.210.0060.00615.42
7.0.200.0020.01116.10
7.0.190.0000.01015.46
7.0.180.0070.00715.11
7.0.170.0090.00615.51
7.0.160.0070.00715.50
7.0.150.0040.00815.27
7.0.140.0030.04118.77
7.0.130.0090.00015.14
7.0.120.0030.01015.33
7.0.110.0070.00715.40
7.0.100.0360.04017.62
7.0.90.0310.02817.53
7.0.80.0290.03717.72
7.0.70.0340.03817.66
7.0.60.0290.03817.72
7.0.50.0230.04617.77
7.0.40.0040.02916.85
7.0.30.0030.05016.83
7.0.20.0080.04216.77
7.0.10.0040.02516.82
7.0.00.0060.04916.67
5.6.400.0040.01214.21
5.6.390.0130.00614.26
5.6.380.0090.00014.16
5.6.370.0030.01314.45
5.6.360.0100.00714.36
5.6.350.0040.00814.49
5.6.340.0120.00314.51
5.6.330.0040.01114.30
5.6.320.0080.00614.59
5.6.310.0070.01014.63
5.6.300.0060.00614.12
5.6.290.0040.01114.36
5.6.280.0050.04017.68
5.6.270.0070.00714.59
5.6.260.0030.00914.54
5.6.250.0060.02417.45
5.6.240.0150.03517.37
5.6.230.0050.03217.55
5.6.220.0070.04217.37
5.6.210.0030.03817.48
5.6.200.0060.03117.58
5.6.190.0150.03017.74
5.6.180.0070.04217.78
5.6.170.0120.03817.59
5.6.160.0050.03717.53
5.6.150.0000.05117.61
5.6.140.0040.04417.72
5.6.130.0100.04017.80
5.6.120.0030.05017.68
5.6.110.0030.04817.64
5.6.100.0030.04217.73
5.6.90.0040.03617.77
5.6.80.0030.03417.31
5.6.70.0060.04617.32
5.6.60.0070.03817.31
5.6.50.0060.03817.32
5.6.40.0090.03817.23
5.6.30.0020.03517.34
5.6.20.0060.02717.45
5.6.10.0070.04317.39
5.6.00.0090.04317.38
5.5.380.0050.04817.38
5.5.370.0090.04217.32
5.5.360.0060.04117.42
5.5.350.0060.04317.25
5.5.340.0090.03817.62
5.5.330.0050.03817.60
5.5.320.0080.04317.76
5.5.310.0060.03117.72
5.5.300.0070.04517.71
5.5.290.0020.04317.58
5.5.280.0050.04017.54
5.5.270.0080.04317.66
5.5.260.0050.04717.61
5.5.250.0080.03617.34
5.5.240.0070.04517.22
5.5.230.0030.03217.16
5.5.220.0050.04017.28
5.5.210.0080.03717.27
5.5.200.0060.04317.34
5.5.190.0070.04517.23
5.5.180.0070.03217.16
5.5.170.0000.01114.16
5.5.160.0080.04017.26
5.5.150.0050.02917.14
5.5.140.0070.04117.16
5.5.130.0070.04417.18
5.5.120.0060.04117.31
5.5.110.0070.04217.16
5.5.100.0050.04017.22
5.5.90.0020.03517.08
5.5.80.0050.04017.21
5.5.70.0070.03917.10
5.5.60.0070.04317.12
5.5.50.0080.03316.98
5.5.40.0030.04417.20
5.5.30.0070.04017.17
5.5.20.0080.03217.20
5.5.10.0060.04617.22
5.5.00.0050.04117.11
5.4.450.0020.04515.15
5.4.440.0050.04215.24
5.4.430.0030.04615.30
5.4.420.0050.02715.19
5.4.410.0050.04315.21
5.4.400.0080.03714.93
5.4.390.0090.03815.18
5.4.380.0050.04014.91
5.4.370.0050.03814.99
5.4.360.0050.03315.06
5.4.350.0050.04015.18
5.4.340.0040.03915.08
5.4.330.0110.00011.09
5.4.320.0040.04414.99
5.4.310.0030.03715.08
5.4.300.0060.03815.11
5.4.290.0020.04414.96
5.4.280.0050.03715.16
5.4.270.0070.04015.08
5.4.260.0070.03715.12
5.4.250.0050.03315.21
5.4.240.0030.04015.29
5.4.230.0050.04015.13
5.4.220.0080.03315.01
5.4.210.0030.04015.11
5.4.200.0070.03914.99
5.4.190.0100.03314.88
5.4.180.0070.03715.13
5.4.170.0100.03715.17
5.4.160.0050.04015.19
5.4.150.0070.02815.12
5.4.140.0070.03013.87
5.4.130.0050.04013.58
5.4.120.0060.03613.79
5.4.110.0050.03513.80
5.4.100.0070.01813.71
5.4.90.0020.04213.80
5.4.80.0080.03313.80
5.4.70.0030.02513.79
5.4.60.0050.04013.68
5.4.50.0050.03513.89
5.4.40.0050.02313.64
5.4.30.0030.04013.73
5.4.20.0030.02613.85
5.4.10.0030.02313.72
5.4.00.0020.04213.54
5.3.290.0100.03512.78
5.3.280.0000.03012.60
5.3.270.0100.03512.56
5.3.260.0030.04012.63
5.3.250.0060.03812.68
5.3.240.0020.03512.65
5.3.230.0050.04312.56
5.3.220.0050.03512.47
5.3.210.0080.04112.39
5.3.200.0010.04312.54
5.3.190.0070.03712.53
5.3.180.0010.03612.58
5.3.170.0060.02512.72
5.3.160.0050.03712.71
5.3.150.0000.04612.51
5.3.140.0030.03112.65
5.3.130.0080.03512.63
5.3.120.0020.04012.64
5.3.110.0040.03912.40
5.3.100.0060.03612.34
5.3.90.0030.03912.27
5.3.80.0090.03012.32
5.3.70.0100.03312.19
5.3.60.0070.04012.26
5.3.50.0020.03612.33
5.3.40.0020.03712.23
5.3.30.0000.02312.09
5.3.20.0070.03712.04
5.3.10.0030.03112.03
5.3.00.0100.03512.02
5.2.170.0100.05311.24
5.2.160.0000.03011.01
5.2.150.0030.05311.28
5.2.140.0070.05711.07
5.2.130.0070.05011.13
5.2.120.0030.05010.99
5.2.110.0000.06311.23
5.2.100.0070.03311.02
5.2.90.0070.06011.16
5.2.80.0030.05711.08
5.2.70.0100.05711.05
5.2.60.0070.06010.99
5.2.50.0030.06710.94
5.2.40.0070.05710.94
5.2.30.0030.04311.11
5.2.20.0030.05710.89
5.2.10.0030.05310.98
5.2.00.0070.06010.66
5.1.60.0070.04710.04
5.1.50.0000.04710.01
5.1.40.0000.0609.82
5.1.30.0070.05710.40
5.1.20.0100.05010.29
5.1.10.0000.05710.13
5.1.00.0030.05010.16
5.0.50.0070.0408.66
5.0.40.0030.0408.48
5.0.30.0030.0578.35
5.0.20.0070.0408.21
5.0.10.0000.0438.25
5.0.00.0100.0578.05
4.4.90.0030.0337.85
4.4.80.0000.0377.85
4.4.70.0030.0337.85
4.4.60.0000.0377.85
4.4.50.0030.0377.85
4.4.40.0000.0577.85
4.4.30.0030.0307.85
4.4.20.0030.0177.85
4.4.10.0030.0337.85
4.4.00.0030.0537.85
4.3.110.0030.0337.85
4.3.100.0000.0307.85
4.3.90.0030.0337.85
4.3.80.0000.0437.85
4.3.70.0000.0337.85
4.3.60.0070.0307.85
4.3.50.0030.0337.85
4.3.40.0030.0507.85
4.3.30.0030.0337.85
4.3.20.0030.0207.85
4.3.10.0030.0407.85
4.3.00.0000.0377.85

preferences:
45.5 ms | 400 KiB | 5 Q