akalongman / akalongman/php-string-compare

function parameter is ignored when set to false

Offen
#1 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
14
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Thanks for the script.

I added a functionality to do a compare case insensitive by adding an additional parameter 'ignore_case'.

    $phpStringCompare = new StringCompare($string1, $string2,

array('remove_html_tags'=>true, 'remove_extra_spaces'=>true, 'ignore_case'=>true,
'remove_punctuation'=>true, 'punctuation_symbols'=>Array('.', ','))
);

I found that when I set the 'ignore_case' parameter to true the script functions as normal. When I set the 'ignore_case' to false then too the script does a case insensitive comparison.
By modifying the lines from

        if (!empty($params['ignore_case'])) {

$this->_ignore_case = $params['ignore_case'];
}

to

        if (isset($params['ignore_case'])) {

$this->_ignore_case = $params['ignore_case'];
}

the script works as expected. This I guess is because of !empty check. false value returns empty using the check and hence skips the steps. Please correct me if I'm missing something.
Thanks,
Pari

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.