src/Matchers/SequenceMatch.php
protected static function intersect($string, $subString, $start)
    {
        $cut = str_split(substr($string, $start, strlen($subString)));
        $comp = str_split($subString);
        foreach ($cut as $i => $c) {
            if ($comp[$i] === $c) {
                $intersect[] = $c;
            } else {
                break; // Stop loop since intersection ends.
            }
        }
        if (!empty($intersect)) {
            return implode('', $intersect);
        }

        return '';
    }
protected static function intersect($string, $subString, $start)
    {
        $cut = str_split(substr($string, $start, strlen($subString)));
        $comp = str_split($subString);
        foreach ($cut as $i => $c) {
            if ($comp[$i] === $c) {
                $intersect[] = $c;
            } else {
                break; // Stop loop since intersection ends.
            }
        }
        if (!empty($intersect)) {
            return implode('', $intersect);
        }

        return '';
    }
protected static function intersect ( $ string , $ subString , $ start ) { $ cut = str_split ( substr ( $ string , $ start , strlen ( $ subString ) ) ) ; $ comp = str_split ( $ subString ) ; foreach ( $ cut as $ i => $ c ) { if ( $ comp [ $ i ] === $ c ) { $ intersect [ ] = $ c ; } else { break ; // Stop loop since intersection ends. } } if ( ! empty ( $ intersect ) ) { return implode ( '' , $ intersect ) ; } return '' ; }
Find sub-string intersection in a string.

@param string $string
@param string $subString
@param int    $start

@return string
Find sub - string intersection in a string .