Query: collator_compare
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
COLLATOR_COMPARE(3) 1 COLLATOR_COMPARE(3) Collator::compare - Compare two Unicode strings Object oriented styleSYNOPSISpublic int Collator::compare (string $str1, string $str2)DESCRIPTIONProcedural style int collator_compare (Collator $coll, string $str1, string $str2) Compare two Unicode strings according to collation rules.PARAMETERSo $coll -Collator object. o $str1 - The first string to compare. o $str2 - The second string to compare.RETURN VALUESReturn comparison result: o 1 if $str1 is greater than $str2 ; o 0 if $str1 is equal to $str2; o -1 if $str1 is less than $str2 . On error boolean FALSE is returned. Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.EXAMPLESExample #1 collator_compare(3)example <?php $s1 = 'Hello'; $s2 = 'hello'; $coll = collator_create( 'en_US' ); $res = collator_compare( $coll, $s1, $s2 ); if ($res === false) { echo collator_get_error_message( $coll ); } else if( $res > 0 ) { echo "s1 is greater than s2 "; } else if( $res < 0 ) { echo "s1 is less than s2 "; } else { echo "s1 is equal to s2 "; } ?> The above example will output:SEE ALSOcollator_sort(3). PHP Documentation Group COLLATOR_COMPARE(3)
Related Man Pages |
---|
strneqvcmp(3) - centos |
collator_asort(3) - php |
collator_compare(3) - php |
collator_get_sort_key(3) - php |
strcspn(3) - php |
Similar Topics in the Unix Linux Community |
---|
Reg: strncpy function |
Convert case on specified position of flat file |
how to get value of value of a variable |
Compare fields within a file |
Compare two files (Many to one comparison) |