3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(levenshtein(utf8_to_extended_ascii('прив'), utf8_to_extended_ascii('привет'))); function utf8_to_extended_ascii($str, &$map) { // find all multibyte characters (cf. utf-8 encoding specs) $matches = array(); if (!preg_match_all('/[\xC0-\xF7][\x80-\xBF]+/', $str, $matches)) return $str; // plain ascii string // update the encoding map with the characters not already met foreach ($matches[0] as $mbc) if (!isset($map[$mbc])) $map[$mbc] = chr(128 + count($map)); // finally remap non-ascii characters return strtr($str, $map); }

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.0130.00918.68
8.3.50.0150.00721.95
8.3.40.0170.00018.60
8.3.30.0110.00419.05
8.3.20.0050.00220.29
8.3.10.0040.00421.97
8.3.00.0000.00822.42
8.2.180.0040.01216.88
8.2.170.0140.00022.96
8.2.160.0090.00620.81
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0030.00626.16
8.2.120.0000.00819.36
8.2.110.0030.00622.20
8.2.100.0040.00717.78
8.2.90.0000.00719.23
8.2.80.0090.00217.97
8.2.70.0000.00817.50
8.2.60.0040.00417.67
8.2.50.0050.00318.07
8.2.40.0000.00918.16
8.2.30.0000.00818.00
8.2.20.0040.00417.54
8.2.10.0040.00417.69
8.2.00.0000.00717.68
8.1.280.0140.00025.92
8.1.270.0080.00022.16
8.1.260.0100.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.79
8.1.230.0060.00619.08
8.1.220.0080.00017.74
8.1.210.0030.00518.77
8.1.200.0100.00017.22
8.1.190.0040.00417.41
8.1.180.0000.00818.10
8.1.170.0090.00018.72
8.1.160.0050.00321.96
8.1.150.0040.00418.54
8.1.140.0040.00417.47
8.1.130.0000.00717.78
8.1.120.0040.00417.29
8.1.110.0000.00817.34
8.1.100.0040.00317.31
8.1.90.0040.00417.20
8.1.80.0000.00717.27
8.1.70.0000.00717.27
8.1.60.0060.00317.55
8.1.50.0030.00617.46
8.1.40.0000.00717.35
8.1.30.0040.00417.54
8.1.20.0000.00817.56
8.1.10.0000.00817.52
8.1.00.0040.00417.33
8.0.300.0030.00318.77
8.0.290.0080.00016.92
8.0.280.0070.00018.46
8.0.270.0040.00417.29
8.0.260.0060.00018.28
8.0.250.0070.00016.89
8.0.240.0000.01016.96
8.0.230.0070.00016.94
8.0.220.0040.00416.86
8.0.210.0040.00416.96
8.0.200.0060.00016.93
8.0.190.0070.00017.01
8.0.180.0040.00416.97
8.0.170.0060.00316.84
8.0.160.0050.00217.02
8.0.150.0030.00616.95
8.0.140.0040.00416.87
8.0.130.0030.00313.36
8.0.120.0000.00716.88
8.0.110.0000.00716.86
8.0.100.0000.00816.69
8.0.90.0000.00716.85
8.0.80.0120.00416.87
8.0.70.0020.00516.76
8.0.60.0000.00816.82
8.0.50.0030.00516.79
8.0.30.0100.01017.19
8.0.20.0110.00817.40
8.0.10.0040.00416.79
8.0.00.0130.00716.74
7.4.330.0000.00515.00
7.4.320.0060.00016.41
7.4.300.0060.00316.46
7.4.290.0050.00216.36
7.4.280.0000.00816.46
7.4.270.0080.00016.47
7.4.260.0070.00016.51
7.4.250.0080.00016.52
7.4.240.0040.00416.40
7.4.230.0000.00716.57
7.4.220.0130.01216.49
7.4.210.0060.01316.40
7.4.200.0030.00316.62
7.4.190.0000.00716.52
7.4.160.0130.00316.48
7.4.150.0040.01317.40
7.4.140.0050.01317.86
7.4.130.0140.00516.35
7.4.120.0030.01416.53
7.4.110.0100.00716.46
7.4.100.0130.00616.66
7.4.90.0190.00316.37
7.4.80.0080.01119.39
7.4.70.0040.01716.61
7.4.60.0150.00316.64
7.4.50.0080.00016.43
7.4.40.0080.00622.77
7.4.30.0060.00916.44
7.4.00.0070.01015.07
7.3.330.0000.00613.27
7.3.320.0000.00513.32
7.3.310.0040.00416.29
7.3.300.0000.00716.32
7.3.290.0070.01016.35
7.3.280.0090.00716.30
7.3.270.0110.00717.40
7.3.260.0120.01216.37
7.3.250.0120.00916.35
7.3.240.0070.01416.31
7.3.230.0060.01116.39
7.3.210.0000.01616.53
7.3.200.0200.00019.39
7.3.190.0060.01116.59
7.3.180.0080.00716.34
7.3.170.0100.01016.37
7.3.160.0090.00616.42
7.3.120.0090.00914.76
7.2.330.0080.01116.55
7.2.320.0040.01416.28
7.2.310.0080.01316.34
7.2.300.0170.00716.31
7.2.290.0030.01316.61
7.2.60.0100.00716.77
7.2.00.0070.00719.28
7.1.200.0090.00615.64
7.1.100.0060.00617.89
7.1.70.0000.00816.70
7.1.60.0060.01619.82
7.1.50.0070.01016.89
7.1.00.0030.07322.45
7.0.200.0040.00416.70
7.0.140.0030.07322.01
7.0.60.0170.07019.86
7.0.50.0070.05317.88
7.0.40.0100.04020.11
7.0.30.0430.07020.10
7.0.20.0330.06720.11
7.0.10.0030.04720.29
7.0.00.0070.08320.09
5.6.280.0030.07321.13
5.6.210.0130.07720.51
5.6.200.0170.07018.23
5.6.190.0200.07320.70
5.6.180.0130.07720.52
5.6.170.0270.05020.52
5.6.160.0100.04720.51
5.6.150.0070.03718.21
5.6.140.0070.03318.35
5.6.130.0130.08018.21
5.6.120.0070.08321.06
5.6.110.0130.07721.02
5.6.100.0100.07721.01
5.6.90.0070.08321.00
5.6.80.0030.08720.43
5.5.350.0030.08320.39
5.5.340.0030.04018.06
5.5.330.0070.07020.47
5.5.320.3130.04020.31
5.5.310.0300.05020.41
5.5.300.0000.04018.02
5.5.290.0170.05718.00
5.5.280.0070.07720.85
5.5.270.0100.05720.79
5.5.260.0100.06321.02
5.5.250.0100.03720.62
5.5.240.0070.06020.30
5.4.450.0200.04719.56
5.4.440.0930.06319.56
5.4.430.1030.05019.60
5.4.420.0100.06019.59
5.4.410.0030.06019.07
5.4.400.0170.04718.85
5.4.390.0070.05318.76
5.4.380.0170.04718.81
5.4.370.0170.05018.79
5.4.360.0170.05318.71
5.4.350.0200.05018.58
5.4.340.0230.04718.83
5.4.320.0060.04412.57
5.4.310.0080.04312.57
5.4.300.0090.03612.57
5.4.290.0060.04712.57
5.4.280.0060.03412.46
5.4.270.0170.05319.13
5.4.260.0070.05318.92
5.4.250.0170.07018.92
5.4.240.0130.06318.92
5.4.230.0100.06719.23
5.4.220.0170.06318.95
5.4.210.0170.05019.01
5.4.200.0200.05318.89
5.4.190.0130.05719.29
5.4.180.0170.06319.04
5.4.170.0130.05018.91
5.4.160.0100.06319.12
5.4.150.0030.07318.96
5.4.140.0170.04716.43
5.4.130.0130.05016.69
5.4.120.0070.05716.38
5.4.110.0100.05316.71
5.4.100.0130.04716.41
5.4.90.0200.04716.64
5.4.80.0070.05716.66
5.4.70.0100.05716.67
5.4.60.0070.05016.64
5.4.50.0200.05016.45
5.4.40.0230.06316.74
5.4.30.0030.06016.67
5.4.20.0030.06316.54
5.4.10.0130.05016.61
5.4.00.0100.06315.87
5.3.290.0060.03912.80
5.3.280.0070.07014.64
5.3.270.0070.05714.61
5.3.260.0130.07314.89
5.3.250.0130.05314.89
5.3.240.0170.04714.66
5.3.230.0070.05314.48
5.3.220.0100.05014.63
5.3.210.0200.06014.75
5.3.200.0070.05014.76
5.3.190.0170.04014.83
5.3.180.0170.06014.82
5.3.170.0030.05714.61
5.3.160.0100.07314.82
5.3.150.0100.05314.78
5.3.140.0030.06014.73
5.3.130.0000.06014.82
5.3.120.0200.05314.66
5.3.110.0070.06014.81
5.3.100.0000.05714.30
5.3.90.0130.05314.01
5.3.80.0070.05314.09
5.3.70.0130.04714.08
5.3.60.0230.04314.26
5.3.50.0130.05314.17
5.3.40.0130.04314.01
5.3.30.0130.05314.20
5.3.20.0030.06013.95
5.3.10.0230.04713.82
5.3.00.0100.05713.84
5.2.170.0030.04311.14
5.2.160.0100.03711.27
5.2.150.0030.04711.43
5.2.140.0000.04711.33
5.2.130.0070.04011.31
5.2.120.0070.04011.16
5.2.110.0130.04711.10
5.2.100.0100.03711.30
5.2.90.0100.04311.32
5.2.80.0070.04310.97
5.2.70.0030.04311.38
5.2.60.0100.04311.26
5.2.50.0100.03711.21
5.2.40.0030.04011.05
5.2.30.0030.04311.27
5.2.20.0100.03711.25
5.2.10.0070.04011.05
5.2.00.0200.02710.90
5.1.60.0030.03310.21
5.1.50.0000.04010.22
5.1.40.0030.04710.20
5.1.30.0030.04010.66
5.1.20.0070.03710.41
5.1.10.0030.04010.28
5.1.00.0070.03310.16
5.0.50.0170.0178.86
5.0.40.0030.0338.40
5.0.30.0000.0438.43
5.0.20.0000.0308.51
5.0.10.0030.0278.33
5.0.00.0070.0478.37
4.4.90.0130.0206.12
4.4.80.0070.0176.12
4.4.70.0100.0236.07
4.4.60.0000.0336.07
4.4.50.0000.0276.07
4.4.40.0030.0336.10
4.4.30.0000.0236.06
4.4.20.0000.0236.06
4.4.10.0030.0306.06
4.4.00.0030.0376.06
4.3.110.0070.0206.06
4.3.100.0030.0206.06
4.3.90.0070.0206.64
4.3.80.0000.0376.64
4.3.70.0100.0136.64
4.3.60.0000.0236.64
4.3.50.0000.0236.64
4.3.40.0030.0376.64
4.3.30.0030.0206.64
4.3.20.0000.0236.64
4.3.10.0000.0276.64
4.3.00.0000.01315.59

preferences:
41.94 ms | 401 KiB | 5 Q