Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 1663
Zeile 35... Zeile 35...
35
            $matrix[$j * $width] = 0;
35
            $matrix[$j * $width] = 0;
36
        }
36
        }
Zeile 37... Zeile 37...
37
 
37
 
38
        for ($i = 1; $i <= $fromLength; ++$i) {
38
        for ($i = 1; $i <= $fromLength; ++$i) {
39
            for ($j = 1; $j <= $toLength; ++$j) {
39
            for ($j = 1; $j <= $toLength; ++$j) {
-
 
40
                $o = ($j * $width) + $i;
-
 
41
 
-
 
42
                // don't use max() to avoid function call overhead
-
 
43
                $firstOrLast = $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0;
-
 
44
 
-
 
45
                if ($matrix[$o - 1] > $matrix[$o - $width]) {
40
                $o          = ($j * $width) + $i;
46
                    if ($firstOrLast > $matrix[$o - 1]) {
-
 
47
                        $matrix[$o] = $firstOrLast;
41
                $matrix[$o] = max(
48
                    } else {
-
 
49
                        $matrix[$o] = $matrix[$o - 1];
-
 
50
                    }
-
 
51
                } else {
42
                    $matrix[$o - 1],
52
                    if ($firstOrLast > $matrix[$o - $width]) {
-
 
53
                        $matrix[$o] = $firstOrLast;
43
                    $matrix[$o - $width],
54
                    } else {
-
 
55
                        $matrix[$o] = $matrix[$o - $width];
44
                    $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0
56
                    }
45
                );
57
                }
46
            }
58
            }
Zeile 47... Zeile 59...
47
        }
59
        }
48
 
60