当前位置: 首页>>代码示例>>PHP>>正文


PHP api_strcmp函数代码示例

本文整理汇总了PHP中api_strcmp函数的典型用法代码示例。如果您正苦于以下问题:PHP api_strcmp函数的具体用法?PHP api_strcmp怎么用?PHP api_strcmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了api_strcmp函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sort_users

/**
 * Function to sort users after getting the list in the DB.
 * Necessary because there are 2 or 3 queries. Called by usort()
 */
function sort_users($user_a, $user_b)
{
    if (api_sort_by_first_name()) {
        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:32,代码来源:tutor_settings.php

示例2: sort_users

/**
 * Function to sort users after getting the list in the DB.
 * Necessary because there are 2 or 3 queries. Called by usort()
 */
function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('platform.order_user_list_by_official_code');
    if ($orderListByOfficialCode === 'true') {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
    if (api_sort_by_first_name()) {
        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:46,代码来源:member_settings.php

示例3: sort_users

/**
 * Function to sort users after getting the list in the DB.
 * Necessary because there are 2 or 3 queries. Called by usort()
 */
function sort_users($user_a, $user_b)
{
    global $_configuration;
    if (isset($_configuration['order_user_list_by_official_code']) && $_configuration['order_user_list_by_official_code']) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
    if (api_sort_by_first_name()) {
        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if ($cmp !== 0) {
            return $cmp;
        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if ($cmp !== 0) {
                return $cmp;
            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
        }
    }
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:46,代码来源:member_settings.php

示例4: sort_by_first_name

 public function sort_by_first_name($item1, $item2)
 {
     return api_strcmp($item1[3], $item2[3]);
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:4,代码来源:flatview_data_generator.class.php

示例5: sort_by_user

 function sort_by_user($item1, $item2)
 {
     $user1 = $item1['user'];
     $user2 = $item2['user'];
     if (api_sort_by_first_name()) {
         $result = api_strcmp($user1['firstname'], $user2['firstname']);
         if ($result == 0) {
             return api_strcmp($user1['lastname'], $user2['lastname']);
         }
     } else {
         $result = api_strcmp($user1['lastname'], $user2['lastname']);
         if ($result == 0) {
             return api_strcmp($user1['firstname'], $user2['firstname']);
         }
     }
     return $result;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:17,代码来源:evalform.class.php

示例6: api_strcasecmp

/**
 * Performs string comparison, case insensitive, language sensitive, with extended multibyte support.
 * @param string $string1				The first string.
 * @param string $string2				The second string.
 * @param string $language (optional)	The language in which comparison is to be made. If language is omitted, interface language is assumed then.
 * @param string $encoding (optional)	The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
 * @return int							Returns < 0 if $string1 is less than $string2; > 0 if $string1 is greater than $string2; and 0 if the strings are equal.
 * This function is aimed at replacing the function strcasecmp() for human-language strings.
 * @link http://php.net/manual/en/function.strcasecmp
 */
function api_strcasecmp($string1, $string2, $language = null, $encoding = null)
{
    return api_strcmp(api_strtolower($string1, $encoding), api_strtolower($string2, $encoding), $language, $encoding);
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:14,代码来源:internationalization.lib.php

示例7: rsort_users

function rsort_users($a, $b)
{
    return api_strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:4,代码来源:index.php

示例8: sort_by_description

 function sort_by_description($item1, $item2)
 {
     $result = api_strcmp($item1->get_description(), $item2->get_description());
     if ($result == 0) {
         return $this->sort_by_name($item1, $item2);
     }
     return $result;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:gradebook_data_generator.class.php

示例9: sort_by_first_name

 function sort_by_first_name($item1, $item2)
 {
     return api_strcmp($item1['firstname'], $item2['firstname']);
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:4,代码来源:results_data_generator.class.php


注:本文中的api_strcmp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。