WP_HTML_Tag_Processor::sort_start_ascending( WP_HTML_Text_Replacement $a, WP_HTML_Text_Replacement $b ): int

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Compare two WP_HTML_Text_Replacement objects.

Parameters

$aWP_HTML_Text_Replacementrequired
First attribute update.
$bWP_HTML_Text_Replacementrequired
Second attribute update.

Return

int Comparison value for string order.

Source

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->end - $b->end;
}

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.