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;
    }