<?php
require_once(dirname(__FILE__).'/unicode.class.php');
header('Content-type: text/html; charset=UTF-8');
$big_endian = true;
// Text Examples
$array_utf8 = array(chr(10), // Control
'a', // ASCII
'Ԋ', // UTF-8
'滝', // UTF-8
);
foreach ($array_utf8 as $i => $text_utf8) {
$text_utf16 = unicode::utf8_to_utf16($text_utf8, $big_endian);
$text_utf32 = unicode::utf8_to_utf32($text_utf8, $big_endian);
echo '<p>Character '.$i.'</p>';
echo '<p>UTF-8: '.unicode::utf8_size($text_utf8).' / '.strlen($text_utf8).'</p>';
echo '<p>UTF-16: '.unicode::utf16_size($text_utf16).' / '.strlen($text_utf16).'</p>';
echo '<p>UTF-32: '.unicode::utf32_size($text_utf32).' / '.strlen($text_utf32).'</p>';
echo '<hr />';
}
exit(0);
|