3v4l.org

run code in 300+ PHP versions simultaneously
<?php function snake($k,$y,$str1,$str2){ $x = $y - $k; while($x < count($str1) && $y < count($str2) && $str1[$x] == $str2[$y]){ $x++; $y++; } return $y; } function edit_distance_onp($str1, $str2){ $s1 = count($str1) > count($str2) ? $str2 : $str1; $s2 = count($str1) > count($str2) ? $str1 : $str2; $fp = array(); $x = 0; $y = 0; $k = 0; $p = 0; $offset = count($s1) + 1; $delta = count($s2) - count($s1); for ($i = 0; $i < 15; $i++) $fp[$i] = -1; for ($p = 0; $fp[$delta + $offset] != count($s2); $p++) { for($k = -$p; $k < $delta; $k++) $fp[$k + $offset] = snake($k, max($fp[$k-1+$offset] + 1, $fp[$k+1+$offset]), $s1, $s2); for($k = $delta + $p; $k > $delta; $k--) $fp[$k + $offset] = snake($k, max($fp[$k-1+$offset] + 1, $fp[$k+1+$offset]), $s1, $s2); $fp[$delta + $offset] = snake($delta, max($fp[$delta-1+$offset] + 1, $fp[$delta+1+$offset]), $s1, $s2); } return $delta + ($p - 1) * 2; } $cha1[0] = "aaa"; $cha1[1] = "bbb"; $cha1[2] = "ccc"; $cha2[0] = "ddd"; $cha2[1] = "eee"; $cha2[2] = "fff"; echo edit_distance_onp($cha1,$cha2); ?>

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.00318.24
8.3.50.0110.00921.92
8.3.40.0070.01118.63
8.3.30.0110.00419.22
8.3.20.0040.00420.30
8.3.10.0050.00223.84
8.3.00.0070.00019.16
8.2.180.0040.01218.17
8.2.170.0090.00922.96
8.2.160.0150.00020.27
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0090.00019.36
8.2.110.0030.00622.22
8.2.100.0040.00818.16
8.2.90.0080.00019.41
8.2.80.0040.00417.97
8.2.70.0050.00317.50
8.2.60.0040.00417.93
8.2.50.0060.00318.07
8.2.40.0120.00018.16
8.2.30.0000.00718.36
8.2.20.0000.00817.88
8.2.10.0000.00718.22
8.2.00.0040.00419.43
8.1.280.0130.00325.92
8.1.270.0080.00023.83
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0040.00423.83
8.1.230.0070.00419.15
8.1.220.0080.00017.79
8.1.210.0040.00418.77
8.1.200.0060.00317.50
8.1.190.0050.00317.22
8.1.180.0040.00418.10
8.1.170.0040.00418.71
8.1.160.0040.00421.96
8.1.150.0040.00418.59
8.1.140.0040.00417.49
8.1.130.0000.00717.91
8.1.120.0040.00417.56
8.1.110.0040.00417.48
8.1.100.0040.00417.38
8.1.90.0000.00717.38
8.1.80.0050.00317.45
8.1.70.0030.00317.35
8.1.60.0030.00617.61
8.1.50.0030.00517.52
8.1.40.0040.00417.45
8.1.30.0000.00917.64
8.1.20.0050.00317.63
8.1.10.0000.00717.61
8.1.00.0030.00517.37
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0070.00018.46
8.0.270.0030.00317.34
8.0.260.0070.00017.40
8.0.250.0000.00716.89
8.0.240.0070.00017.01
8.0.230.0000.00716.82
8.0.220.0000.00816.81
8.0.210.0000.00716.80
8.0.200.0030.00316.89
8.0.190.0050.00216.92
8.0.180.0040.00416.83
8.0.170.0040.00416.91
8.0.160.0000.00716.95
8.0.150.0040.00416.91
8.0.140.0070.00016.86
8.0.130.0000.00613.38
8.0.120.0000.00716.91
8.0.110.0040.00416.95
8.0.100.0000.00716.96
8.0.90.0000.00717.03
8.0.80.0110.00716.90
8.0.70.0040.00416.98
8.0.60.0070.00016.92
8.0.50.0000.00816.88
8.0.30.0080.01017.22
8.0.20.0080.01017.40
8.0.10.0050.00316.92
8.0.00.0110.00716.80
7.4.330.0000.00515.05
7.4.320.0070.00016.63
7.4.300.0070.00016.61
7.4.290.0030.00316.51
7.4.280.0030.00616.57
7.4.270.0030.00416.57
7.4.260.0040.00416.57
7.4.250.0020.00516.57
7.4.240.0030.00316.57
7.4.230.0040.00416.65
7.4.220.0040.01416.55
7.4.210.0130.00316.70
7.4.200.0070.00016.36
7.4.160.0130.00316.49
7.4.150.0160.01017.40
7.4.140.0110.00917.86
7.4.130.0090.02116.61
7.4.120.0130.00516.54
7.4.110.0140.00316.51
7.4.100.0170.00616.51
7.4.90.0090.01216.42
7.4.80.0030.01919.39
7.4.70.0130.00316.53
7.4.60.0110.00516.66
7.4.50.0000.00616.57
7.4.40.0060.01016.70
7.4.30.0120.00916.47
7.4.00.0070.00714.66
7.3.330.0030.00313.18
7.3.320.0000.00613.43
7.3.310.0070.00016.49
7.3.300.0030.00316.26
7.3.290.0110.00416.40
7.3.280.0080.00816.37
7.3.270.0160.00017.40
7.3.260.0070.01116.66
7.3.250.0100.01116.46
7.3.240.0120.00916.48
7.3.230.0100.00716.63
7.3.210.0070.01016.40
7.3.200.0070.01419.39
7.3.190.0090.01216.56
7.3.180.0040.01216.55
7.3.170.0070.01016.54
7.3.160.0030.01216.64
7.3.120.0100.00314.89
7.3.10.0110.00516.48
7.3.00.0210.00316.25
7.2.330.0100.00716.80
7.2.320.0120.00916.88
7.2.310.0030.01416.42
7.2.300.0030.01316.82
7.2.290.0130.00316.64
7.2.130.0100.01016.29
7.2.120.0120.00616.54
7.2.110.0130.00716.72
7.2.100.0090.00916.95
7.2.90.0080.01216.46
7.2.80.0130.00316.91
7.2.70.0220.00816.74
7.2.60.0120.00516.74
7.2.50.0170.00416.55
7.2.40.0040.01816.28
7.2.30.0170.00616.58
7.2.20.0150.00816.56
7.2.10.0170.00716.96
7.2.00.0070.00818.08
7.1.250.0110.00715.52
7.1.200.0070.00715.62
7.1.100.0000.00917.70
7.1.70.0000.00717.32
7.1.60.0110.01519.70
7.1.50.0030.01016.85
7.1.00.0030.07322.34
7.0.200.0000.00816.78
7.0.140.0070.07022.12
7.0.60.0030.07019.98
7.0.50.0030.08018.02
7.0.40.0030.07720.15
7.0.30.0270.03320.34
7.0.20.0300.07020.23
7.0.10.0200.05720.24
7.0.00.0030.04720.14
5.6.280.0030.07321.16
5.6.210.0170.07320.68
5.6.200.0200.07318.18
5.6.190.0030.08320.61
5.6.180.0030.05020.48
5.6.170.0070.05020.54
5.6.160.0070.05020.53
5.6.150.0070.08318.15
5.6.140.0130.08018.16
5.6.130.0070.04718.23
5.6.120.0070.07320.99
5.6.110.0070.04021.15
5.6.100.0130.06721.09
5.6.90.0170.08021.00
5.6.80.0100.05720.41
5.6.70.0170.04020.53
5.5.350.0030.07720.31
5.5.340.0030.04018.09
5.5.330.0070.04720.41
5.5.320.0330.07320.36
5.5.310.0200.06020.23
5.5.300.0100.04718.00
5.5.290.0000.04318.08
5.5.280.0100.06720.66
5.5.270.0170.07720.97
5.5.260.0070.08720.77
5.5.250.0030.04020.67
5.5.240.0100.06720.28
5.4.450.0270.04029.27
5.4.440.0430.04728.63
5.4.430.0230.05029.27
5.4.420.0330.05022.40
5.4.410.0270.04321.57
5.4.400.0300.04321.56
5.4.390.0370.05021.36
5.4.380.0230.05018.79
5.4.370.0230.05018.76
5.4.360.0270.06718.51
5.4.350.0270.04718.52
5.4.340.0170.05018.62
5.4.320.0110.03912.52
5.4.310.0120.03712.51
5.4.300.0090.04012.51
5.4.290.0040.04112.51
5.4.280.0080.03312.41
5.4.270.0090.03412.41
5.4.260.0060.04612.41
5.4.250.0060.03712.41
5.4.240.0060.03512.41
5.4.230.0070.03912.39
5.4.220.0060.03512.40
5.4.210.0040.03712.40
5.4.200.0070.03512.40
5.4.190.0090.03212.39
5.4.180.0050.03512.39
5.4.170.0030.03812.41
5.4.160.0070.03412.40
5.4.150.0050.03612.39
5.4.140.0040.03812.08
5.4.130.0050.03612.07
5.4.120.0050.03712.02
5.4.110.0040.03612.02
5.4.100.0060.03412.02
5.4.90.0080.04312.02
5.4.80.0080.03512.02
5.4.70.0050.03512.02
5.4.60.0040.03612.02
5.4.50.0070.03512.02
5.4.40.0080.03112.00
5.4.30.0030.03712.00
5.4.20.0080.03212.00
5.4.10.0080.03112.00
5.4.00.0050.03811.50
5.3.290.0070.04312.80
5.3.280.0020.04112.71
5.3.270.0020.04112.72
5.3.260.0060.03812.72
5.3.250.0100.03212.72
5.3.240.0060.04312.72
5.3.230.0060.03612.71
5.3.220.0070.03612.68
5.3.210.0100.03412.68
5.3.200.0100.03212.68
5.3.190.0030.04012.68
5.3.180.0090.03312.68
5.3.170.0040.03812.67
5.3.160.0110.04112.67
5.3.150.0050.04412.67
5.3.140.0090.03812.66
5.3.130.0070.04012.66
5.3.120.0090.05112.66
5.3.110.0100.04412.66
5.3.100.0050.05112.13
5.3.90.0040.03912.12
5.3.80.0050.03712.11
5.3.70.0070.04212.11
5.3.60.0060.03612.10
5.3.50.0040.03812.04
5.3.40.0080.04312.04
5.3.30.0050.04112.00
5.3.20.0070.03811.78
5.3.10.0070.03611.75
5.3.00.0100.03511.74
5.2.170.0050.0319.24
5.2.160.0050.0339.23
5.2.150.0050.0309.23
5.2.140.0070.0289.23
5.2.130.0030.0319.19
5.2.120.0040.0369.19
5.2.110.0030.0339.20
5.2.100.0060.0289.20
5.2.90.0040.0299.20
5.2.80.0030.0319.20
5.2.70.0070.0379.20
5.2.60.0060.0329.15
5.2.50.0040.0319.12
5.2.40.0030.0319.10
5.2.30.0060.0289.07
5.2.20.0030.0309.06
5.2.10.0060.0268.96
5.2.00.0050.0338.82
5.1.60.0040.0258.11
5.1.50.0030.0278.11
5.1.40.0070.0288.09
5.1.30.0070.0348.44
5.1.20.0020.0338.46
5.1.10.0010.0288.19
5.1.00.0030.0268.19
5.0.50.0020.0226.68
5.0.40.0040.0196.54
5.0.30.0030.0396.35
5.0.20.0050.0186.32
5.0.10.0040.0196.29
5.0.00.0030.0316.30
4.4.90.0040.0144.78
4.4.80.0020.0154.76
4.4.70.0030.0154.75
4.4.60.0050.0214.76
4.4.50.0040.0184.77
4.4.40.0010.0274.71
4.4.30.0040.0144.76
4.4.20.0010.0174.85
4.4.10.0040.0184.85
4.4.00.0000.0284.76
4.3.110.0020.0164.67
4.3.100.0000.0184.67
4.3.90.0020.0194.63
4.3.80.0010.0284.59
4.3.70.0040.0144.63
4.3.60.0030.0144.63
4.3.50.0030.0154.63
4.3.40.0020.0264.54
4.3.30.0030.0153.35
4.3.20.0040.0213.33
4.3.10.0020.0163.28
4.3.00.0070.02021.36

preferences:
42.35 ms | 401 KiB | 5 Q