IntlChar getBlockCode() function in PHP


The IntlChar getBlockCode() function is used to get the Unicode allocation block containing the value val.

Syntax

IntlChar::getBlockCode (val)

Parameters

  • val − An integer or character encoded as a UTF-8 string.

Return

The IntlChar getBlockCode()function returns the block value for val. The following is the listing −

  • IntlChar::BLOCK_CODE_BASIC_LATIN

  • IntlChar::BLOCK_CODE_GREEK

  • IntlChar::BLOCK_CODE_MISCELLANEOUS_SYMBOLS

Example

The following is an example −

<?php
   var_dump(IntlChar::getBlockCode("A") === IntlChar::BLOCK_CODE_BASIC_LATIN);
   echo "<br>";
   var_dump(IntlChar::getBlockCode("PQRS") === IntlChar::BLOCK_CODE_BASIC_LATIN);
   echo "<br>";
   var_dump(IntlChar::getBlockCode("u{2603}") === IntlChar::BLOCK_CODE_MISCELLANEOUS_SYMBOLS);
?>

Output

The following is the output −

bool(true)
bool(false)
bool(false)

Updated on: 31-Dec-2019

28 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements