R3m/framework Function reference string.substring.compare

{string.substring.compare(String $haystack, String $needle, Int $offset=0, Int $length=null, Boolean $case_insensitive=false)}

Binary safe comparison of two strings from an offset, up to length characters.

{string.substring.compare()} compares haystack from position offset with needle up to length characters.

    The main string being compared.
    The secondary string being compared.
    The start position for the comparison. If negative, it starts counting from the end of the string.
    The length of the comparison. The default value is the largest of the length of the needle compared to the length of haystack minus the offset.
    If case_insensitive is true, comparison is case insensitive.

Returns < 0 if haystack from position offset is less than needle, > 0 if it is greater than needle, and 0 if they are equal.
If offset is equal to (prior to PHP 7.2.18, 7.3.5) or greater than the length of haystack, or the length is set and is less than 0, {string.substring.compare()} prints a warning and returns false.

More information:


Last modified: 2021-06-07

© 2021 universeorange.com