_wp_object_name_sort_cb

Serves as a callback for comparing objects based on name.

Description

(int) _wp_object_name_sort_cb( (object) $a, (object) $b ); 

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

  1. if ( !function_exists( '_wp_object_name_sort_cb' ) ) { 
  2. require_once ABSPATH . WPINC . '/category-template.php'; 
  3.  
  4. // The first object to compare. 
  5. $a = null; 
  6.  
  7. // The second object to compare. 
  8. $b = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _wp_object_name_sort_cb($a, $b); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/category-template.php  
  1. function _wp_object_name_sort_cb( $a, $b ) { 
  2. return strnatcasecmp( $a->name, $b->name );