PHP code example of cybercog / php-unicode

1. Go to this page and download the library: Download cybercog/php-unicode library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cybercog / php-unicode example snippets


$string = \Cog\Unicode\UnicodeString::of('Hello');

$string = \Cog\Unicode\UnicodeString::of('Hello');

echo strval($string); // (string) "Hello"

$character = \Cog\Unicode\Character::of('ÿ');

$character = \Cog\Unicode\Character::ofDecimal(255);

$character = \Cog\Unicode\Character::ofHexadecimal('U+00FF');

$character = \Cog\Unicode\Character::ofHtmlEntity('&yuml;');

$character = \Cog\Unicode\Character::ofXmlEntity('&#xff;');

$character = \Cog\Unicode\Character::of('ÿ');

echo strval($character); // (string) "ÿ"

echo $character->toDecimal(); // (int) 255

echo $character->toHexadecimal(); // (string) "U+00FF"

echo $character->toHtmlEntity(); // (string) "&yuml;"

echo $character->toXmlEntity(); // (string) "&#xff;"
shell
composer