3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doHash($string) { if ($string == "") return ""; $passwordChars = "abcdefghijklmnopqrstuvwxyz_"; $hashChars = "0123456789ABCDEF"; $hashedString = ""; $hashArray = Array(32); for($i=0; $i<32; $i++) $hashArray[$i]=GetCharacterKey($string, $i); for ($i=0; $i<32; $i++) { if (strpos($passwordChars, substr($string, $i%strlen($string), 1)) == -1) $string= substr($string, 0, $i%strlen($string)) . "_" . substr($string, ($i%strlen($string))+1, (strlen($string)-($i%strlen($string)))-1); $hashArray[$i] += (floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))/9)*16 + floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))%9/3)*4 + floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))%3)); for ($j=0; $j<3; $j++){ if (($hashArray[$i]&(48>>($j*2))) == (32>>($j*2)) && (GetCharacterKey($string, $i)&(1<<$j))==(1<<$j)) { $hashArray[i]=($hashArray[$i]&(255-(48>>($j*2)))) + (48>>($j*2)); } } for ($j=0; $j<2; $j++) { $hashArray[$i] += floor($hashArray[($i+$j)%32]/1234)*pow(4,$j+3); echo floor($hashArray[($i+$j)%32]/1234) . " "; } $doubleByteHashNumber = 0; for ($j=0; $j<16; $j++){ $doubleByteHashNumber += (($hashArray[$i]&pow(2,($j*2)+($i%2)))>>($j+($i%2))); } $hashArray[$i] = $doubleByteHashNumber; $hashedString .= substr($hashChars, floor((($hashArray[$i]&65280)>>8)/16), 1); $hashedString .= substr($hashChars, floor((($hashArray[$i]&65280)>>8)%16), 1); $hashedString .= substr($hashChars, floor(($hashArray[$i]&255)/16), 1); $hashedString .= substr($hashChars, floor(($hashArray[$i]&255)%16), 1); } return $hashedString; } function GetCharacterKey($string, $character) { $passwordChars = "abcdefghijklmnopqrstuvwxyz_"; $key = strpos($passwordChars, $string[$character%strlen($string)]); for($i=0; $i<10+strlen($string)+($character*3); $i++) { $key = ($key<<1); $key %= 2147483648; $key += strpos($passwordChars, $string[$i%strlen($string)]); $key = floor(sin($key)*1000000); } if ($key < 0) { return -(2147483648 - ($key & 2147483584)); } else { return ($key & 2147483584); } } echo doHash("ab"); ?>

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.00917.12
8.3.50.0120.01221.40
8.3.40.0090.00619.11
8.3.30.0090.00619.17
8.3.20.0030.00619.15
8.3.10.0080.00022.15
8.3.00.0060.00318.54
8.2.180.0090.00917.00
8.2.170.0080.00822.96
8.2.160.0080.00821.57
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00418.71
8.2.120.0080.00026.35
8.2.110.0070.00321.41
8.2.100.0060.00618.25
8.2.90.0080.00019.76
8.2.80.0030.00618.00
8.2.70.0060.00318.00
8.2.60.0060.00318.53
8.2.50.0080.00018.07
8.2.40.0060.00320.26
8.2.30.0030.00518.50
8.2.20.0000.00818.30
8.2.10.0040.00418.58
8.2.00.0040.00418.41
8.1.280.0110.01125.92
8.1.270.0040.00424.34
8.1.260.0090.00028.09
8.1.250.0000.00828.09
8.1.240.0060.00319.73
8.1.230.0120.00018.27
8.1.220.0030.00518.29
8.1.210.0000.01018.77
8.1.200.0070.00317.73
8.1.190.0080.00017.98
8.1.180.0000.00818.15
8.1.170.0060.00319.14
8.1.160.0040.00422.31
8.1.150.0000.00820.91
8.1.140.0050.00319.95
8.1.130.0000.00718.13
8.1.120.0000.00817.86
8.1.110.0040.00417.73
8.1.100.0000.00817.91
8.1.90.0040.00417.83
8.1.80.0000.00917.89
8.1.70.0000.00717.79
8.1.60.0040.00418.00
8.1.50.0000.00918.02
8.1.40.0000.00817.97
8.1.30.0000.00918.11
8.1.20.0090.00018.02
8.1.10.0030.00518.02
8.1.00.0080.00017.81
8.0.300.0000.00818.77
8.0.290.0070.00317.25
8.0.280.0040.00418.84
8.0.270.0000.00717.69
8.0.260.0040.00417.81
8.0.250.0070.00017.47
8.0.240.0040.00417.32
8.0.230.0040.00417.41
8.0.220.0040.00417.31
8.0.210.0000.00717.32
8.0.200.0000.00917.41
8.0.190.0000.00917.39
8.0.180.0000.00917.24
8.0.170.0000.00817.41
8.0.160.0000.00817.33
8.0.150.0040.00417.36
8.0.140.0080.00017.23
8.0.130.0000.00613.71
8.0.120.0030.00617.29
8.0.110.0040.00417.15
8.0.100.0040.00417.30
8.0.90.0000.00817.34
8.0.80.0030.01917.21
8.0.70.0040.00417.10
8.0.60.0050.00317.16
8.0.50.0060.00317.42
8.0.30.0110.00917.27
8.0.20.0110.01017.46
8.0.10.0040.00417.38
8.0.00.0130.00617.07
7.4.330.0030.00315.08
7.4.320.0030.00317.11
7.4.300.0000.00616.97
7.4.290.0000.00816.91
7.4.280.0080.00016.84
7.4.270.0000.00716.95
7.4.260.0000.00817.05
7.4.250.0040.00417.03
7.4.240.0040.00416.95
7.4.230.0040.00417.04
7.4.220.0160.01316.86
7.4.210.0000.01416.95
7.4.200.0040.00416.96
7.4.160.0090.00916.75
7.4.150.0120.00817.40
7.4.140.0080.01417.86
7.4.130.0090.01116.90
7.4.120.0080.01316.91
7.4.110.0080.01216.83
7.4.100.0110.00716.79
7.4.90.0080.01216.78
7.4.80.0130.00619.39
7.4.70.0070.01116.88
7.4.60.0150.00316.88
7.4.50.0080.00816.96
7.4.40.0090.00916.80
7.4.30.0070.01016.96
7.4.00.0110.00815.13
7.3.330.0000.00713.70
7.3.320.0030.00313.82
7.3.310.0040.00416.69
7.3.300.0080.00016.86
7.3.290.0090.00916.74
7.3.280.0100.00916.74
7.3.270.0080.01117.40
7.3.260.0120.00916.78
7.3.250.0190.00516.78
7.3.240.0090.01116.88
7.3.230.0110.00716.63
7.3.210.0140.00316.93
7.3.200.0040.01519.39
7.3.190.0170.00317.00
7.3.180.0070.01116.68
7.3.170.0140.00816.86
7.3.160.0060.01216.85
7.3.120.0070.01315.49
7.3.110.0030.01715.21
7.3.100.0110.00815.22
7.3.90.0080.00715.38
7.3.80.0070.00715.26
7.3.70.0050.00815.29
7.3.60.0030.01015.28
7.3.50.0010.01215.15
7.3.40.0070.00715.27
7.3.30.0020.01115.33
7.3.20.0020.00916.71
7.3.10.0040.01117.21
7.3.00.0040.01116.98
7.2.330.0070.01717.14
7.2.320.0080.01116.86
7.2.310.0090.01216.73
7.2.300.0060.01317.19
7.2.290.0060.01517.14
7.2.250.0070.01415.55
7.2.240.0080.01115.38
7.2.230.0040.01415.58
7.2.220.0040.01115.41
7.2.210.0050.01015.53
7.2.200.0050.00915.58
7.2.190.0030.00915.45
7.2.180.0080.00715.51
7.2.170.0060.01115.53
7.2.160.0040.01115.71
7.2.150.0060.00317.29
7.2.140.0030.01417.52
7.2.130.0070.01317.13
7.2.120.0000.01117.09
7.2.110.0070.01017.38
7.2.100.0090.00917.34
7.2.90.0080.00317.24
7.2.80.0060.01017.30
7.2.70.0130.00617.38
7.2.60.0100.01017.36
7.2.50.0100.01017.52
7.2.40.0060.00917.20
7.2.30.0090.00917.35
7.2.20.0110.00317.08
7.2.10.0060.00917.09
7.2.00.0030.01118.53
7.1.330.0050.01216.09
7.1.320.0030.01016.22
7.1.310.0050.00916.03
7.1.300.0030.01016.13
7.1.290.0000.01716.05
7.1.280.0050.01416.18
7.1.270.0050.01116.03
7.1.260.0080.00816.17
7.1.250.0070.01416.13
7.1.240.0030.01216.21
7.1.230.0140.00316.23
7.1.220.0060.00616.29
7.1.210.0040.01415.95
7.1.200.0070.01016.18
7.1.190.0030.01716.20
7.1.180.0030.01716.27
7.1.170.0040.01516.15
7.1.160.0000.01416.27
7.1.150.0100.01016.20
7.1.140.0040.00715.96
7.1.130.0080.00316.21
7.1.120.0050.00516.25
7.1.110.0060.00916.37
7.1.100.0050.00817.13
7.1.90.0070.00716.03
7.1.80.0090.00616.17
7.1.70.0060.00616.84
7.1.60.0070.01517.73
7.1.50.0060.00916.36
7.1.40.0110.00416.13
7.1.30.0070.00716.16
7.1.20.0070.00716.21
7.1.10.0060.00916.20
7.1.00.0060.04019.49
7.0.330.0030.01315.86
7.0.320.0060.01215.48
7.0.310.0030.01015.76
7.0.300.0030.00915.52
7.0.290.0070.01015.83
7.0.280.0060.01115.53
7.0.270.0070.00715.99
7.0.260.0060.00915.84
7.0.250.0090.00615.89
7.0.240.0060.00915.95
7.0.230.0090.00315.82
7.0.220.0040.00815.86
7.0.210.0040.00715.86
7.0.200.0010.01016.58
7.0.190.0040.01115.86
7.0.180.0050.00815.85
7.0.170.0040.01115.70
7.0.160.0080.00815.75
7.0.150.0030.01015.88
7.0.140.0030.01015.55
7.0.130.0100.00715.68
7.0.120.0070.01115.44
7.0.110.0050.00515.75
7.0.100.0100.00315.54
7.0.90.0030.01315.80
7.0.80.0080.00815.73
7.0.70.0060.00615.90
7.0.60.0020.02618.80
7.0.50.0170.03618.29
7.0.40.0080.03817.28
7.0.30.0150.03617.02
7.0.20.0160.03317.24
7.0.10.0050.04017.30
7.0.00.0180.03617.09
5.6.400.0040.01814.79
5.6.390.0070.01114.80
5.6.380.0060.01214.69
5.6.370.0130.01014.66
5.6.360.0030.01214.55
5.6.350.0040.00815.07
5.6.340.0090.00914.64
5.6.330.0060.01215.13
5.6.320.0060.01014.75
5.6.310.0060.01314.95
5.6.300.0110.00414.92
5.6.290.0000.01514.95
5.6.280.0030.04418.10
5.6.270.0090.00915.18
5.6.260.0030.01414.86
5.6.250.0030.01414.91
5.6.240.0040.00814.92
5.6.230.0070.01114.66
5.6.220.0100.01014.67
5.6.210.0070.04317.84
5.6.200.0100.03718.01
5.6.190.0130.03818.21
5.6.180.0180.03318.18
5.6.170.0230.02818.16
5.6.160.0230.03118.18
5.6.150.0200.03518.04
5.6.140.0250.03418.10
5.6.130.0130.04118.11
5.6.120.0150.03518.12
5.6.110.0190.03918.24
5.6.100.0150.03717.91
5.6.90.0170.04317.94
5.6.80.0100.03717.68
5.6.70.0080.03717.73
5.6.60.0130.03017.70
5.6.50.0100.03617.69
5.6.40.0070.04217.69
5.6.30.0100.05017.48
5.6.20.0110.03617.62
5.6.10.0120.03317.91
5.6.00.0100.04317.78
5.5.380.0070.01014.49
5.5.370.0030.01215.10
5.5.360.0090.00614.91
5.5.350.0180.04517.70
5.5.340.0200.04717.91
5.5.330.0200.03017.90
5.5.320.0150.03017.97
5.5.310.0150.03317.90
5.5.300.0150.03318.09
5.5.290.0070.05018.04
5.5.280.0150.03517.93
5.5.270.0060.05117.96
5.5.260.0300.03717.85
5.5.250.0100.05217.86
5.5.240.0100.03417.55
5.5.230.0150.02917.40
5.5.220.0130.03217.49
5.5.210.0130.03017.49
5.5.200.0080.03817.70
5.5.190.0200.03517.62
5.5.180.0070.03617.77
5.5.170.0030.01614.98
5.5.160.0100.03417.56
5.5.150.0080.03517.38
5.5.140.0210.02617.69
5.5.130.0180.02817.55
5.5.120.0190.02917.42
5.5.110.0170.04217.70
5.5.100.0190.04317.60
5.5.90.0130.04617.57
5.5.80.0150.03717.45
5.5.70.0120.03317.69
5.5.60.0120.03017.58
5.5.50.0200.02517.55
5.5.40.0180.03017.62
5.5.30.0180.03117.53
5.5.20.0180.03217.38
5.5.10.0100.04117.53
5.5.00.0130.03417.60

preferences:
58.16 ms | 401 KiB | 5 Q