WP_HTML_Tag_Processor::sort_start_ascending()
Compare two WP_HTML_Text_Replacement objects.
Method of the class: WP_HTML_Tag_Processor{}
No Hooks.
Return
Int
. Comparison value for string order.
Usage
$result = WP_HTML_Tag_Processor::sort_start_ascending( $a, $b );
- $a(WP_HTML_Text_Replacement) (required)
- First attribute update.
- $b(WP_HTML_Text_Replacement) (required)
- Second attribute update.
Changelog
Since 6.2.0 | Introduced. |
WP_HTML_Tag_Processor::sort_start_ascending() WP HTML Tag Processor::sort start ascending code WP 6.6.2
private static function sort_start_ascending( $a, $b ) { $by_start = $a->start - $b->start; if ( 0 !== $by_start ) { return $by_start; } $by_text = isset( $a->text, $b->text ) ? strcmp( $a->text, $b->text ) : 0; if ( 0 !== $by_text ) { return $by_text; } /* * This code should be unreachable, because it implies the two replacements * start at the same location and contain the same text. */ return $a->length - $b->length; }