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); } $doubleByteHashNumber = 0; for ($j=0; $j<16; $j++){ $doubleByteHashNumber += (($hashArray[$i]&pow(2,($j*2)+($i%2)))>>($j+($i%2))); } $hashArray[$i] = $doubleByteHashNumber; echo ($hashArray[$i]&65280)>>8; echo " " .($hashArray[$i]&255) . "\n"; $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.40.0100.01319.13
8.3.30.0130.00319.13
8.3.20.0070.00719.24
8.3.10.0090.00022.00
8.3.00.0040.00418.39
8.2.170.0100.00622.96
8.2.160.0080.00821.36
8.2.150.0060.00324.18
8.2.140.0060.00324.66
8.2.130.0000.01018.55
8.2.120.0050.00326.35
8.2.110.0040.00422.42
8.2.100.0130.00018.13
8.2.90.0060.00319.85
8.2.80.0030.00618.00
8.2.70.0000.00918.13
8.2.60.0080.00018.55
8.2.50.0030.00618.13
8.2.40.0060.00320.57
8.2.30.0040.00418.45
8.2.20.0040.00418.20
8.2.10.0040.00418.55
8.2.00.0030.00518.57
8.1.270.0050.00324.25
8.1.260.0080.00028.09
8.1.250.0040.00428.09
8.1.240.0090.00024.17
8.1.230.0030.00918.11
8.1.220.0000.00918.35
8.1.210.0000.00818.77
8.1.200.0070.00317.85
8.1.190.0000.00917.72
8.1.180.0030.00618.10
8.1.170.0030.00619.07
8.1.160.0030.00522.43
8.1.150.0040.00419.46
8.1.140.0080.00020.05
8.1.130.0060.00318.18
8.1.120.0040.00417.88
8.1.110.0050.00317.74
8.1.100.0000.00817.79
8.1.90.0050.00317.91
8.1.80.0040.00417.81
8.1.70.0040.00417.98
8.1.60.0030.00617.97
8.1.50.0040.00418.02
8.1.40.0000.00917.96
8.1.30.0030.00618.10
8.1.20.0000.00818.02
8.1.10.0050.00318.01
8.1.00.0030.00517.95
8.0.300.0030.00618.77
8.0.290.0000.00917.38
8.0.280.0040.00418.80
8.0.270.0040.00417.64
8.0.260.0120.00017.60
8.0.250.0030.00317.42
8.0.240.0090.00017.42
8.0.230.0050.00317.41
8.0.220.0000.00817.22
8.0.210.0000.00717.28
8.0.200.0000.00717.39
8.0.190.0070.00317.46
8.0.180.0040.00417.37
8.0.170.0050.00317.29
8.0.160.0040.00417.34
8.0.150.0030.00517.36
8.0.140.0080.00017.19
8.0.130.0030.00313.78
8.0.120.0060.00317.19
8.0.110.0000.00817.27
8.0.100.0040.00417.18
8.0.90.0060.00317.25
8.0.80.0080.00817.24
8.0.70.0040.00417.40
8.0.60.0030.00617.49
8.0.50.0040.00417.38
8.0.30.0100.01117.43
8.0.20.0140.00717.43
8.0.10.0030.00517.23
8.0.00.0130.00717.03
7.4.330.0030.00315.08
7.4.320.0000.00717.09
7.4.300.0000.00617.04
7.4.290.0000.00716.95
7.4.280.0000.00816.84
7.4.270.0000.00717.07
7.4.260.0000.00716.91
7.4.250.0000.00917.07
7.4.240.0000.00817.01
7.4.230.0050.00216.84
7.4.220.0090.01916.99
7.4.210.0090.00617.01
7.4.200.0040.00417.04
7.4.160.0110.00616.81
7.4.150.0060.01517.40
7.4.140.0080.01117.86
7.4.130.0120.00716.78
7.4.120.0090.01016.78
7.4.110.0140.01016.69
7.4.100.0090.00916.78
7.4.90.0070.01116.79
7.4.80.0070.01719.39
7.4.70.0070.01416.88
7.4.60.0040.01416.80
7.4.50.0060.00916.80
7.4.40.0070.01716.77
7.4.30.0060.01317.09
7.4.00.0040.01215.38
7.3.330.0090.00013.57
7.3.320.0030.00313.72
7.3.310.0000.00716.71
7.3.300.0030.00316.84
7.3.290.0000.00716.82
7.3.280.0100.00716.69
7.3.270.0070.01117.40
7.3.260.0130.01316.64
7.3.250.0130.00816.95
7.3.240.0090.00916.70
7.3.230.0030.01616.97
7.3.210.0030.01716.91
7.3.200.0030.01519.39
7.3.190.0060.01216.72
7.3.180.0150.00616.67
7.3.170.0110.00616.85
7.3.160.0070.01116.90
7.3.120.0110.00415.29
7.3.110.0100.00315.24
7.3.100.0070.00715.04
7.3.90.0060.00915.41
7.3.80.0090.00615.41
7.3.70.0000.01315.18
7.3.60.0070.01015.50
7.3.50.0090.00615.05
7.3.40.0100.00615.36
7.3.30.0040.01215.32
7.3.20.0060.00917.07
7.3.10.0100.01116.79
7.3.00.0070.01316.73
7.2.330.0120.00617.18
7.2.320.0090.00916.85
7.2.310.0110.01517.08
7.2.300.0120.00616.90
7.2.290.0160.00316.97
7.2.240.0060.00915.45
7.2.230.0110.00315.34
7.2.220.0070.00715.30
7.2.210.0000.01615.54
7.2.200.0000.01615.63
7.2.190.0090.00315.38
7.2.180.0030.00915.34
7.2.170.0060.00615.66
7.2.160.0100.00715.29
7.2.150.0090.00917.16
7.2.140.0070.01017.30
7.2.130.0130.01217.29
7.2.120.0140.00717.06
7.2.110.0100.01417.22
7.2.100.0090.00817.03
7.2.90.0130.01417.22
7.2.80.0130.01017.12
7.2.70.0140.00616.88
7.2.60.0110.00917.14
7.2.50.0120.01217.35
7.2.40.0140.00717.15
7.2.30.0130.01117.15
7.2.20.0100.00717.14
7.2.10.0150.00716.95
7.2.00.0100.01017.98
7.1.330.0040.01116.05
7.1.320.0030.00716.28
7.1.310.0060.00916.26
7.1.300.0090.00616.01
7.1.290.0070.00715.96
7.1.280.0030.01016.24
7.1.270.0030.00916.23
7.1.260.0030.00916.38
7.1.250.0050.01515.99
7.1.200.0000.01416.32
7.1.100.0000.01118.19
7.1.70.0130.00417.56
7.1.60.0090.01519.33
7.1.00.0000.07722.82
7.0.200.0060.00617.31
7.0.60.0130.09022.00
7.0.50.0270.05720.70
7.0.40.0300.05720.62
7.0.30.0300.05720.60
7.0.20.0400.08020.54
7.0.10.0330.08720.59
7.0.00.0270.07020.57
5.6.280.0030.07721.46
5.6.210.0170.06720.81
5.6.200.0230.06321.52
5.6.190.0330.06321.32
5.6.180.0100.06721.33
5.6.170.0400.06021.27
5.6.160.0270.06321.43
5.6.150.0330.06321.33
5.6.140.0170.06021.40
5.6.130.0270.08021.39
5.6.120.0170.09321.30
5.6.110.0100.07021.20
5.6.100.0230.05721.35
5.6.90.0200.06721.26
5.6.80.0200.05320.70
5.6.70.0270.05020.81
5.6.60.0170.06320.73
5.6.50.0100.07020.69
5.6.40.0170.06320.77
5.6.30.0130.06020.64
5.6.20.0170.05720.78
5.6.10.0130.07320.84
5.6.00.0170.05320.62
5.5.350.0330.07720.65
5.5.340.0230.06021.11
5.5.330.0230.06021.11
5.5.320.0130.05721.11
5.5.310.0430.05721.10
5.5.300.0170.05721.27
5.5.290.0170.06721.08
5.5.280.0200.09021.08
5.5.270.0100.06721.21
5.5.260.0200.06321.07
5.5.250.0230.05320.99
5.5.240.0130.06720.48
5.5.230.0270.05320.36
5.5.220.0230.05320.49
5.5.210.0330.04720.46
5.5.200.0230.05320.47
5.5.190.0170.05720.38
5.5.180.0100.07320.54
5.5.160.0170.05320.63
5.5.150.0270.04720.46
5.5.140.0200.05320.45
5.5.130.0130.06720.34
5.5.120.0230.05720.64
5.5.110.0070.07020.53
5.5.100.0200.08020.26
5.5.90.0200.05320.43
5.5.80.0130.05320.50
5.5.70.0170.05720.52
5.5.60.0170.05320.20
5.5.50.0170.05320.48
5.5.40.0200.08720.42
5.5.30.0230.06320.40
5.5.20.0300.05320.41
5.5.10.0100.07320.35
5.5.00.0330.07020.44

preferences:
57.41 ms | 400 KiB | 5 Q