src/DataHandling.php
private static function startsWithInternal($stringOrStrings, $optionOrOptions, $matchEnd, $alphanumeric, $caseInsensitive)
    {
        $strings = is_array($stringOrStrings) ? $stringOrStrings : [$stringOrStrings];
        $options = is_array($optionOrOptions) ? $optionOrOptions : [$optionOrOptions];

        foreach($strings as $string) {
            $stringMatched = false;

            if ($alphanumeric) {
                $string = self::sanitizeAlphanumeric($string);
            }

            foreach($options as $option) {
                if ($alphanumeric) {
                    $option = self::sanitizeAlphanumeric($option);
                }

                if (strlen($option) <= strlen($string) && substr_compare($string, $option,
                    $matchEnd ? -strlen($option) : 0, strlen($option), $caseInsensitive) === 0) {
                    $stringMatched = true;
                    break;
                }
            }

            if (!$stringMatched) {
                return false;
            }
        }

        return true;
    }
private static function startsWithInternal($stringOrStrings, $optionOrOptions, $matchEnd, $alphanumeric, $caseInsensitive)
    {
        $strings = is_array($stringOrStrings) ? $stringOrStrings : [$stringOrStrings];
        $options = is_array($optionOrOptions) ? $optionOrOptions : [$optionOrOptions];

        foreach($strings as $string) {
            $stringMatched = false;

            if ($alphanumeric) {
                $string = self::sanitizeAlphanumeric($string);
            }

            foreach($options as $option) {
                if ($alphanumeric) {
                    $option = self::sanitizeAlphanumeric($option);
                }

                if (strlen($option) <= strlen($string) && substr_compare($string, $option,
                    $matchEnd ? -strlen($option) : 0, strlen($option), $caseInsensitive) === 0) {
                    $stringMatched = true;
                    break;
                }
            }

            if (!$stringMatched) {
                return false;
            }
        }

        return true;
    }
private static function startsWithInternal ( $ stringOrStrings , $ optionOrOptions , $ matchEnd , $ alphanumeric , $ caseInsensitive ) { $ strings = is_array ( $ stringOrStrings ) ? $ stringOrStrings : [ $ stringOrStrings ] ; $ options = is_array ( $ optionOrOptions ) ? $ optionOrOptions : [ $ optionOrOptions ] ; foreach ( $ strings as $ string ) { $ stringMatched = false ; if ( $ alphanumeric ) { $ string = self :: sanitizeAlphanumeric ( $ string ) ; } foreach ( $ options as $ option ) { if ( $ alphanumeric ) { $ option = self :: sanitizeAlphanumeric ( $ option ) ; } if ( strlen ( $ option ) <= strlen ( $ string ) && substr_compare ( $ string , $ option , $ matchEnd ? - strlen ( $ option ) : 0 , strlen ( $ option ) , $ caseInsensitive ) === 0 ) { $ stringMatched = true ; break ; } } if ( ! $ stringMatched ) { return false ; } } return true ; }
Internal method used by all startsWith and endsWith methods to keep code in one place.

@param string|string[] $stringOrStrings
@param string|string[] $optionOrOptions
@param bool $matchEnd
@param bool $alphanumeric
@param bool $caseInsensitive
@return bool
Internal method used by all startsWith and endsWith methods to keep code in one place .