static function fastCombiningSort( $string ) {
		self::loadData();
		$len = strlen( $string );
		$out = '';
		$combiners = [];
		$lastClass = -1;
		for ( $i = 0; $i < $len; $i++ ) {
			$c = $string[$i];
			$n = ord( $c );
			if ( $n >= 0x80 ) {
				if ( $n >= 0xf0 ) {
					$c = substr( $string, $i, 4 );
					$i += 3;
				} elseif ( $n >= 0xe0 ) {
					$c = substr( $string, $i, 3 );
					$i += 2;
				} elseif ( $n >= 0xc0 ) {
					$c = substr( $string, $i, 2 );
					$i++;
				}
				if ( isset( self::$utfCombiningClass[$c] ) ) {
					$lastClass = self::$utfCombiningClass[$c];
					if ( isset( $combiners[$lastClass] ) ) {
						$combiners[$lastClass] .= $c;
					} else {
						$combiners[$lastClass] = $c;
					}
					continue;
				}
			}
			if ( $lastClass ) {
				ksort( $combiners );
				$out .= implode( '', $combiners );
				$combiners = [];
			}
			$out .= $c;
			$lastClass = 0;
		}
		if ( $lastClass ) {
			ksort( $combiners );
			$out .= implode( '', $combiners );
		}

		return $out;
	}
static function fastCombiningSort( $string ) {
		self::loadData();
		$len = strlen( $string );
		$out = '';
		$combiners = [];
		$lastClass = -1;
		for ( $i = 0; $i < $len; $i++ ) {
			$c = $string[$i];
			$n = ord( $c );
			if ( $n >= 0x80 ) {
				if ( $n >= 0xf0 ) {
					$c = substr( $string, $i, 4 );
					$i += 3;
				} elseif ( $n >= 0xe0 ) {
					$c = substr( $string, $i, 3 );
					$i += 2;
				} elseif ( $n >= 0xc0 ) {
					$c = substr( $string, $i, 2 );
					$i++;
				}
				if ( isset( self::$utfCombiningClass[$c] ) ) {
					$lastClass = self::$utfCombiningClass[$c];
					if ( isset( $combiners[$lastClass] ) ) {
						$combiners[$lastClass] .= $c;
					} else {
						$combiners[$lastClass] = $c;
					}
					continue;
				}
			}
			if ( $lastClass ) {
				ksort( $combiners );
				$out .= implode( '', $combiners );
				$combiners = [];
			}
			$out .= $c;
			$lastClass = 0;
		}
		if ( $lastClass ) {
			ksort( $combiners );
			$out .= implode( '', $combiners );
		}

		return $out;
	}
static function fastCombiningSort ( $ string ) { self :: loadData ( ) ; $ len = strlen ( $ string ) ; $ out = '' ; $ combiners = [ ] ; $ lastClass = - 1 ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ c = $ string [ $ i ] ; $ n = ord ( $ c ) ; if ( $ n >= 0x80 ) { if ( $ n >= 0xf0 ) { $ c = substr ( $ string , $ i , 4 ) ; $ i += 3 ; } elseif ( $ n >= 0xe0 ) { $ c = substr ( $ string , $ i , 3 ) ; $ i += 2 ; } elseif ( $ n >= 0xc0 ) { $ c = substr ( $ string , $ i , 2 ) ; $ i ++ ; } if ( isset ( self :: $ utfCombiningClass [ $ c ] ) ) { $ lastClass = self :: $ utfCombiningClass [ $ c ] ; if ( isset ( $ combiners [ $ lastClass ] ) ) { $ combiners [ $ lastClass ] .= $ c ; } else { $ combiners [ $ lastClass ] = $ c ; } continue ; } } if ( $ lastClass ) { ksort ( $ combiners ) ; $ out .= implode ( '' , $ combiners ) ; $ combiners = [ ] ; } $ out .= $ c ; $ lastClass = 0 ; } if ( $ lastClass ) { ksort ( $ combiners ) ; $ out .= implode ( '' , $ combiners ) ; } return $ out ; }
Sorts combining characters into canonical order. This is the
final step in creating decomposed normal forms D and KD.
@private
@param string $string a valid, decomposed UTF-8 string. Input is not validated.
@return string a UTF-8 string with combining characters sorted in canonical order
Sorts combining characters into canonical order . This is the final step in creating decomposed normal forms D and KD .