WP_HTML_Tag_Processor::sort_start_ascending()private staticWP 6.2.0

Compare two WP_HTML_Text_Replacement objects.

Метод класса: WP_HTML_Tag_Processor{}

Хуков нет.

Возвращает

int. Comparison value for string order.

Использование

$result = WP_HTML_Tag_Processor::sort_start_ascending( $a, $b );
$a(WP_HTML_Text_Replacement) (обязательный)
First attribute update.
$b(WP_HTML_Text_Replacement) (обязательный)
Second attribute update.

Список изменений

С версии 6.2.0 Введена.

Код WP_HTML_Tag_Processor::sort_start_ascending() 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;
}