Open In App

PHP | IntlChar enumCharNames() Function

The IntlChar::enumCharNames() function is an inbuilt function in PHP which is used to give a catalog of all the assigned Unicode characters that are available within a range. The list will have the Unicode characters that are available between the start code points (start inclusive) and the limit code points (limit exclusive). A function is going to be called for each and the code point value will be passed on along with the character name. Those who are different from the new & modern names, only those will get cataloged, for Unicode 1.0 names.
Syntax: 

void IntlChar::enumCharNames( $start, $limit, $callback,
$nameChoice = IntlChar::UNICODE_CHAR_NAME )  

Parameters: This function accepts four parameters as mentioned and described below: 



Return Values: This function does not return any value.
Below program illustrates the IntlChar::enumCharNames() function in PHP:
Program: 




<?php
 
// PHP program to uses IntlChar::enumCharNames()
// function
IntlChar::enumCharNames(0x2700, 0x2710,
    function($codepoint, $nameChoice, $name) {
        printf("U+%04x %s\n", $codepoint, $name);
});
 
?>

Output: 



U+2700 BLACK SAFETY SCISSORS
U+2701 UPPER BLADE SCISSORS
U+2702 BLACK SCISSORS
U+2703 LOWER BLADE SCISSORS
U+2704 WHITE SCISSORS
U+2705 WHITE HEAVY CHECK MARK
U+2706 TELEPHONE LOCATION SIGN
U+2707 TAPE DRIVE
U+2708 AIRPLANE
U+2709 ENVELOPE
U+270a RAISED FIRST
U+270b RAISED HAND
U+270c VICTORY HAND
U+270d WRITING HAND
U+270e LOWER RIGHT PENCIL
U+270f PENCIL

Reference: https://www.php.net/manual/en/intlchar.enumcharnames.php

Article Tags :