src/Categories.php
public function aliasesCategories(string $chr) : array
    {
        $l = 0;
        $r = count($this->categoriesData['code_points_ranges']);
        $c = mb_ord($chr, $this->encoding);

        // Binary Search
        while ($r >= $l){
            $m = floor(($l + $r) / 2);
            if ($c < $this->categoriesData['code_points_ranges'][$m][0]) {
                $r = $m - 1;
            } else if ($c > $this->categoriesData['code_points_ranges'][$m][1]) {
                $l = $m + 1;
            } else {
                return [
                    $this->categoriesData['iso_15924_aliases'][$this->categoriesData['code_points_ranges'][$m][2]],
                    $this->categoriesData['categories'][$this->categoriesData['code_points_ranges'][$m][3]],
                ];
            }
        }

        return ['Unknown', 'Zzzz'];
    }
public function aliasesCategories(string $chr) : array
    {
        $l = 0;
        $r = count($this->categoriesData['code_points_ranges']);
        $c = mb_ord($chr, $this->encoding);

        // Binary Search
        while ($r >= $l){
            $m = floor(($l + $r) / 2);
            if ($c < $this->categoriesData['code_points_ranges'][$m][0]) {
                $r = $m - 1;
            } else if ($c > $this->categoriesData['code_points_ranges'][$m][1]) {
                $l = $m + 1;
            } else {
                return [
                    $this->categoriesData['iso_15924_aliases'][$this->categoriesData['code_points_ranges'][$m][2]],
                    $this->categoriesData['categories'][$this->categoriesData['code_points_ranges'][$m][3]],
                ];
            }
        }

        return ['Unknown', 'Zzzz'];
    }
public function aliasesCategories ( string $ chr ) : array { $ l = 0 ; $ r = count ( $ this -> categoriesData [ 'code_points_ranges' ] ) ; $ c = mb_ord ( $ chr , $ this -> encoding ) ; // Binary Search while ( $ r >= $ l ) { $ m = floor ( ( $ l + $ r ) / 2 ) ; if ( $ c < $ this -> categoriesData [ 'code_points_ranges' ] [ $ m ] [ 0 ] ) { $ r = $ m - 1 ; } else if ( $ c > $ this -> categoriesData [ 'code_points_ranges' ] [ $ m ] [ 1 ] ) { $ l = $ m + 1 ; } else { return [ $ this -> categoriesData [ 'iso_15924_aliases' ] [ $ this -> categoriesData [ 'code_points_ranges' ] [ $ m ] [ 2 ] ] , $ this -> categoriesData [ 'categories' ] [ $ this -> categoriesData [ 'code_points_ranges' ] [ $ m ] [ 3 ] ] , ] ; } } return [ 'Unknown' , 'Zzzz' ] ; }
Retrieves the script block alias and unicode category for a unicode character.

e.g.

aliasesCategories('A') -> ['LATIN', 'L']
aliasesCategories('τ') -> ['GREEK', 'L']
aliasesCategories('-') -> ['COMMON', 'Pd']

@param string $chr A unicode character
@return array The script block alias and unicode category for a unicode character.
Retrieves the script block alias and unicode category for a unicode character .