Exemple #1
0
function compare_pairs($locale, $test_array)
{
    $res_str = '';
    $coll = ut_coll_create($locale);
    foreach ($test_array as $test_strings) {
        list($str1, $str2) = $test_strings;
        // Compare strings.
        $res_val = cmp_to_char(ut_coll_compare($coll, $str1, $str2));
        // Concatenate result strings.
        $res_str .= dump($str1) . ' ' . $res_val . ' ' . dump($str2) . "\n";
    }
    return $res_str;
}
function cmp_array(&$coll, $a)
{
    $res = '';
    $prev = null;
    foreach ($a as $i) {
        if (is_null($prev)) {
            $res .= "{$i}";
        } else {
            $eqrc = ut_coll_compare($coll, $prev, $i);
            $eq = $eqrc < 0 ? "<" : ($eqrc > 0 ? ">" : "=");
            $res .= " {$eq} {$i}";
        }
        $prev = $i;
    }
    $res .= "\n";
    return $res;
}