PHP | IntlChar enumCharTypes() Function
The IntlChar::enumCharTypes() function is an inbuilt function in PHP which is used to give a catalog of all the code points with their Unicode general categories. All the cataloging happens very efficiently of all the code points. For enumerating all the assigned code points and building data structures etc, this will be very useful. The callback function is called for each code points of a contiguous range with a given general category and the character type. Adjacent ranges could have different types. The guarantee that the numeric value of the type will be 0 to 31 is guaranteed by the Unicode Standard.
void IntlChar::enumCharTypes( $callback )
Parameters: This function accepts single parameter $callback. For each contiguous range of code points with the same general category, the function will be called. The callback function contains three parameters which are listed below:
- integer $start: It is the starting code point.
- integer $end: It is the ending code point.
- integer $name: The category type (one of the IntlChar::CHAR_CATEGORY_* constants)
Return Values: This function does not return any value.
Below program illustrates the IntlChar::enumCharTypes() function in PHP:
U+0000 through U+0020 are in category 15 U+0020 through U+0021 are in category 12 U+0021 through U+0024 are in category 23 U+0024 through U+0025 are in category 25 U+0025 through U+0028 are in category 23 U+0028 through U+0029 are in category 20 U+0029 through U+002a are in category 21 U+002a through U+002b are in category 23 U+002b through U+002c are in category 24 U+002c through U+002d are in category 23 U+002d through U+002e are in category 19 U+002e through U+0030 are in category 23 U+0030 through U+003a are in category 9 ...