src/Util/Strings.php
public static function findPrefix($first, ...$strings): string
    {
        if (\is_array($first)) {
            $strings = $first;
            $first = $strings[0];
            unset($strings[0]);
        }

        for ($i = 0, $n = \strlen($first); $i < $n; $i++) {
            foreach ($strings as $s) {
                if (!isset($s[$i]) || $first[$i] !== $s[$i]) {
                    while ($i && $first[$i - 1] >= "\x80" && $first[$i] >= "\x80" && $first[$i] < "\xC0") {
                        $i--;
                    }

                    return \substr($first, 0, $i);
                }
            }
        }

        return $first;
    }
public static function findPrefix($first, ...$strings): string
    {
        if (\is_array($first)) {
            $strings = $first;
            $first = $strings[0];
            unset($strings[0]);
        }

        for ($i = 0, $n = \strlen($first); $i < $n; $i++) {
            foreach ($strings as $s) {
                if (!isset($s[$i]) || $first[$i] !== $s[$i]) {
                    while ($i && $first[$i - 1] >= "\x80" && $first[$i] >= "\x80" && $first[$i] < "\xC0") {
                        $i--;
                    }

                    return \substr($first, 0, $i);
                }
            }
        }

        return $first;
    }
public static function findPrefix ( $ first , ... $ strings ) : string { if ( \ is_array ( $ first ) ) { $ strings = $ first ; $ first = $ strings [ 0 ] ; unset ( $ strings [ 0 ] ) ; } for ( $ i = 0 , $ n = \ strlen ( $ first ) ; $ i < $ n ; $ i ++ ) { foreach ( $ strings as $ s ) { if ( ! isset ( $ s [ $ i ] ) || $ first [ $ i ] !== $ s [ $ i ] ) { while ( $ i && $ first [ $ i - 1 ] >= "\x80" && $ first [ $ i ] >= "\x80" && $ first [ $ i ] < "\xC0" ) { $ i -- ; } return \ substr ( $ first , 0 , $ i ) ; } } } return $ first ; }
Finds the length of common prefix of strings.

@param string|array $first
@param array        ...$strings

@return string
Finds the length of common prefix of strings .