_wp_object_name_sort_cb
Serves as a callback for comparing objects based on name.
Description
Used with uasort(…)..
Returns (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`.
Parameters (2)
- 0. $a (object)
- The first object to compare.
- 1. $b (object)
- The second object to compare.
Usage
if ( !function_exists( '_wp_object_name_sort_cb' ) ) { require_once ABSPATH . WPINC . '/category-template.php'; } // The first object to compare. $a = null; // The second object to compare. $b = null; // NOTICE! Understand what this does before running. $result = _wp_object_name_sort_cb($a, $b);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/category-template.php
- function _wp_object_name_sort_cb( $a, $b ) {
- return strnatcasecmp( $a->name, $b->name );
- }