Wednesday, March 29, 2017

PHP 7 - IntlChar

In PHP7, a new IntlChar class is added, which seeks to expose additional ICU functionality. This class defines a number of static methods and constants, which can be used to manipulate unicode characters. You need to have Intl extension installed prior to using this class.

Example

<?php
   printf('%x', IntlChar::CODEPOINT_MAX);
   print (IntlChar::charName('@'));
   print(IntlChar::ispunct('!'));
?>
It produces the following browser output −
10ffff
COMMERCIAL AT
true

1 comment: