collator_compare(3) php man page | unix.com

Man Page: collator_compare

Operating Environment: php

Section: 3

COLLATOR_COMPARE(3)							 1						       COLLATOR_COMPARE(3)

Collator::compare - Compare two Unicode strings

	Object oriented style

SYNOPSIS
public int Collator::compare (string $str1, string $str2)
DESCRIPTION
Procedural style int collator_compare (Collator $coll, string $str1, string $str2) Compare two Unicode strings according to collation rules.
PARAMETERS
o $coll -Collator object. o $str1 - The first string to compare. o $str2 - The second string to compare.
RETURN VALUES
Return 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.
EXAMPLES
Example #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 ALSO
collator_sort(3). PHP Documentation Group COLLATOR_COMPARE(3)
Related Man Pages
strneqvcmp(3) - debian
collator_sort(3) - php
levenshtein(3) - php
strcoll(3) - php
strnatcasecmp(3) - php
Similar Topics in the Unix Linux Community
string manipulation
Convert case on specified position of flat file
compare between files size
Compare fields in files
Compare two files (Many to one comparison)