_wp_object_name_sort_cb

函式
_wp_object_name_sort_cb ( $a, $b )
Access
Private
引數
  • (object) $a The first object to compare.
    Required:
  • (object) $b The second object to compare.
    Required:
返回值
  • (int) Negative number if `$a->name` is less than `$b->name`, zero if they are equal, or greater than zero if `$a->name` is greater than `$b->name`.
定義位置
相關方法
_wp_object_count_sort_cbwp_get_nav_menu_to_editwp_get_nav_menuswp_customize_support_scriptwp_robots_noindex_search
引入
3.1.0
棄用
-

_wp_object_name_sort_cb: 這個函式是一個回撥函式,用於根據物件的名稱屬性進行排序。

作為一個回撥,用於根據名稱比較物件。

與`uasort()`一起使用。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _wp_object_name_sort_cb( $a, $b ) {
return strnatcasecmp( $a->name, $b->name );
}
function _wp_object_name_sort_cb( $a, $b ) { return strnatcasecmp( $a->name, $b->name ); }
function _wp_object_name_sort_cb( $a, $b ) {
	return strnatcasecmp( $a->name, $b->name );
}

常見問題

FAQs
檢視更多 >