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; $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); } // Modified to support x64 machines. // $key &= 4294967232; // return $key; if ($key < 0) { return -(2147483648 - ($key & 2147483584)); } else { return ($key & 2147483584); } } echo doHash("a_B_c_") . "\n"; echo doHash("a_a_c_"); ?>

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.0140.01017.25
8.3.50.0190.00621.44
8.3.40.0070.01119.27
8.3.30.0120.00919.07
8.3.20.0060.00319.14
8.3.10.0030.00722.18
8.3.00.0060.00318.43
8.2.180.0110.01416.75
8.2.170.0070.01022.96
8.2.160.0030.01321.27
8.2.150.0030.00624.18
8.2.140.0060.00324.66
8.2.130.0030.00620.21
8.2.120.0000.00826.35
8.2.110.0120.00021.25
8.2.100.0090.00618.00
8.2.90.0030.00619.59
8.2.80.0060.00318.00
8.2.70.0070.00418.00
8.2.60.0030.00718.30
8.2.50.0030.00818.07
8.2.40.0030.00620.32
8.2.30.0030.00618.64
8.2.20.0030.00618.27
8.2.10.0000.01018.52
8.2.00.0030.00618.71
8.1.280.0070.01125.92
8.1.270.0000.00924.21
8.1.260.0030.00728.09
8.1.250.0000.00928.09
8.1.240.0100.00021.72
8.1.230.0070.00718.20
8.1.220.0030.00618.29
8.1.210.0070.00318.77
8.1.200.0070.00717.98
8.1.190.0040.00717.85
8.1.180.0000.01118.10
8.1.170.0000.01019.09
8.1.160.0000.00922.54
8.1.150.0070.00321.01
8.1.140.0050.00519.88
8.1.130.0000.00918.29
8.1.120.0030.00717.86
8.1.110.0000.01017.81
8.1.100.0030.00717.75
8.1.90.0000.00917.83
8.1.80.0000.00917.90
8.1.70.0070.00317.76
8.1.60.0030.00618.05
8.1.50.0030.00817.94
8.1.40.0040.00717.94
8.1.30.0030.00717.91
8.1.20.0030.00617.97
8.1.10.0030.00617.88
8.1.00.0060.00617.87
8.0.300.0030.00618.77
8.0.290.0070.00317.25
8.0.280.0000.01018.78
8.0.270.0030.00617.71
8.0.260.0070.00417.55
8.0.250.0000.00917.40
8.0.240.0030.00617.38
8.0.230.0030.00617.25
8.0.220.0030.00617.31
8.0.210.0060.00317.24
8.0.200.0060.00317.27
8.0.190.0070.00317.34
8.0.180.0030.00717.32
8.0.170.0050.00517.38
8.0.160.0060.00317.31
8.0.150.0070.00317.25
8.0.140.0030.00617.09
8.0.130.0000.00813.74
8.0.120.0000.01017.24
8.0.110.0060.00317.28
8.0.100.0030.00617.20
8.0.90.0060.00317.34
8.0.80.0060.01117.25
8.0.70.0000.01017.28
8.0.60.0030.00717.17
8.0.50.0000.01017.47
8.0.30.0090.01517.47
8.0.20.0100.01517.51
8.0.10.0000.00917.52
8.0.00.0150.00616.92
7.4.330.0000.00715.08
7.4.320.0000.00817.09
7.4.300.0050.00317.04
7.4.290.0000.01116.82
7.4.280.0070.00316.95
7.4.270.0030.00617.03
7.4.260.0030.00616.94
7.4.250.0070.00316.91
7.4.240.0090.00016.95
7.4.230.0030.00617.09
7.4.220.0030.02017.04
7.4.210.0080.00916.80
7.4.200.0030.00717.19
7.4.160.0090.00916.72
7.4.150.0130.01017.40
7.4.140.0150.00717.86
7.4.130.0110.00916.92
7.4.120.0120.01317.09
7.4.110.0080.01616.80
7.4.100.0100.01016.72
7.4.90.0100.01016.84
7.4.80.0070.02119.39
7.4.70.0060.01516.92
7.4.60.0060.01316.80
7.4.50.0000.01717.13
7.4.40.0160.01316.75
7.4.30.0030.01616.91
7.4.10.0050.01715.42
7.4.00.0070.01415.35
7.3.330.0030.00613.63
7.3.320.0040.00413.62
7.3.310.0040.00416.71
7.3.300.0090.00016.79
7.3.290.0070.01416.74
7.3.280.0090.01316.71
7.3.270.0070.01417.40
7.3.260.0100.01016.93
7.3.250.0100.01116.91
7.3.240.0120.00916.97
7.3.230.0140.01416.74
7.3.210.0040.01516.74
7.3.200.0160.01319.39
7.3.190.0070.01316.93
7.3.180.0060.01316.86
7.3.170.0080.01316.82
7.3.160.0120.00716.95
7.3.130.0080.01415.20
7.3.120.0050.01915.40
7.3.110.0110.01315.17
7.3.100.0050.01415.42
7.3.90.0060.01415.39
7.3.80.0050.01115.53
7.3.70.0070.00915.28
7.3.60.0050.01015.19
7.3.50.0110.00815.20
7.3.40.0050.00915.28
7.3.30.0080.00815.34
7.3.20.0070.01116.96
7.3.10.0080.00916.90
7.3.00.0040.01116.94
7.2.330.0090.01217.07
7.2.320.0130.00717.15
7.2.310.0100.01017.10
7.2.300.0200.02017.27
7.2.290.0130.01017.11
7.2.260.0090.01415.61
7.2.250.0070.01715.63
7.2.240.0080.01215.47
7.2.230.0030.01815.37
7.2.220.0020.01815.46
7.2.210.0020.01715.42
7.2.200.0030.01415.40
7.2.190.0060.01215.45
7.2.180.0050.01115.44
7.2.170.0040.01615.44
7.2.160.0040.01615.56
7.2.150.0020.01517.43
7.2.140.0070.00717.32
7.2.130.0080.00917.26
7.2.120.0050.01217.20
7.2.110.0080.01017.17
7.2.100.0060.01217.27
7.2.90.0060.01317.24
7.2.80.0080.01017.21
7.2.70.0100.00917.39
7.2.60.0070.01017.33
7.2.50.0010.01617.26
7.2.40.0040.01317.28
7.2.30.0050.01317.33
7.2.20.0060.01417.24
7.2.10.0090.00917.23
7.2.00.0060.01217.16
7.1.330.0080.01316.41
7.1.320.0050.01716.33
7.1.310.0060.01116.23
7.1.300.0070.00916.23
7.1.290.0070.01016.18
7.1.280.0060.01216.29
7.1.270.0070.01316.06
7.1.260.0030.01716.17
7.1.250.0020.01416.13
7.1.240.0000.01616.22
7.1.230.0090.01116.22
7.1.220.0080.01016.01
7.1.210.0050.01216.11
7.1.200.0050.01416.32
7.1.190.0070.01015.97
7.1.180.0020.01716.27
7.1.170.0050.01216.16
7.1.160.0050.01416.13
7.1.150.0060.01616.05
7.1.140.0050.01816.12
7.1.130.0000.01816.12
7.1.120.0030.01716.23
7.1.110.0080.01116.12
7.1.100.0070.01515.90
7.1.90.0080.01516.38
7.1.80.0040.01516.11
7.1.70.0050.01316.74
7.1.60.0070.01817.12
7.1.50.0030.01916.19
7.1.40.0030.01416.09
7.1.30.0070.01516.20
7.1.20.0050.01215.91
7.1.10.0080.01216.07
7.1.00.0050.03718.48
7.0.330.0080.01015.58
7.0.320.0030.01915.79
7.0.310.0060.01115.89
7.0.300.0020.01615.82
7.0.290.0000.02015.72
7.0.280.0080.01015.87
7.0.270.0030.01615.74
7.0.260.0090.00715.80
7.0.250.0050.01215.86
7.0.240.0050.01715.98
7.0.230.0100.01015.71
7.0.220.0050.01515.79
7.0.210.0050.01215.86
7.0.200.0060.01116.10
7.0.190.0050.01515.80
7.0.180.0060.01515.89
7.0.170.0030.01415.86
7.0.160.0080.01115.87
7.0.150.0050.01515.82
7.0.140.0080.01315.75
7.0.130.0030.01515.84
7.0.120.0080.01115.75
7.0.110.0050.01415.75
7.0.100.0050.01415.84
7.0.90.0080.01415.77
7.0.80.0070.01515.69
7.0.70.0050.01415.94
7.0.60.0080.03217.95
7.0.50.0090.03017.34
7.0.40.0090.02916.06
7.0.30.0080.03116.09
7.0.20.0090.03516.05
7.0.10.0080.03116.05
7.0.00.0080.03616.12
5.6.400.0080.01714.96
5.6.390.0070.01714.91
5.6.380.0030.02014.91
5.6.370.0030.02314.74
5.6.360.0050.02314.88
5.6.350.0080.02115.00
5.6.340.0030.02314.94
5.6.330.0050.02215.00
5.6.320.0100.02115.00
5.6.310.0080.02215.06
5.6.300.0030.02414.64
5.6.290.0030.02414.88
5.6.280.0050.04416.95
5.6.270.0090.01814.79
5.6.260.0020.02415.03
5.6.250.0080.01914.93
5.6.240.0020.02514.79
5.6.230.0070.02314.77
5.6.220.0050.02414.82
5.6.210.0080.03316.82
5.6.200.0120.03617.09
5.6.190.0140.03417.08
5.6.180.0100.03916.93
5.6.170.0080.04016.96
5.6.160.0070.04016.92
5.6.150.0080.03816.86
5.6.140.0050.04116.92
5.6.130.0090.04417.00
5.6.120.0090.04716.98
5.6.110.0140.04417.06
5.6.100.0090.04116.97
5.6.90.0040.03916.96
5.6.80.0120.03916.72
5.6.70.0090.04116.66
5.6.60.0110.03516.67
5.6.50.0110.03616.71
5.6.40.0110.03716.61
5.6.30.0090.03816.64
5.6.20.0100.03616.61
5.6.10.0100.03416.57
5.6.00.0090.03516.70
5.5.380.0050.01914.78
5.5.370.0080.01614.73
5.5.360.0070.01914.71
5.5.350.0130.03916.81
5.5.340.0140.03316.98
5.5.330.0100.03516.82
5.5.320.0080.03816.94
5.5.310.0040.04216.83
5.5.300.0080.03717.02
5.5.290.0120.03616.85
5.5.280.0110.04517.03
5.5.270.0100.05216.89
5.5.260.0140.03716.90
5.5.250.0100.04116.77
5.5.240.0150.04616.76
5.5.230.0110.03716.58
5.5.220.0070.04216.78
5.5.210.0070.03816.56
5.5.200.0100.03516.66
5.5.190.0120.03516.67
5.5.180.0100.03916.69
5.5.170.0050.02014.71
5.5.160.0090.03716.56
5.5.150.0060.04316.55
5.5.140.0070.03916.56
5.5.130.0100.03416.70
5.5.120.0080.03716.74
5.5.110.0110.03916.52
5.5.100.0110.03916.65
5.5.90.0110.03416.57
5.5.80.0150.03216.66
5.5.70.0090.03916.62
5.5.60.0110.03616.48
5.5.50.0070.03516.55
5.5.40.0070.03816.65
5.5.30.0110.03916.63
5.5.20.0050.03816.70
5.5.10.0070.04016.59
5.5.00.0150.03416.60

preferences:
63.83 ms | 401 KiB | 5 Q