1--TEST--
2mbstring Unicode Data tests
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7
8echo "Char widths:\n";
9
10print "ASCII (PHP): " .      mb_strwidth('PHP',    'UTF-8')    . "\n";
11
12print "Vietnamese (Xin chào): " . mb_strwidth('Xin chào',    'UTF-8')    . "\n";
13
14print "Traditional Chinese (你好): " . mb_strwidth('你好',    'UTF-8')    . "\n";
15
16print "Sinhalese (අයේෂ්): " . mb_strwidth('අයේෂ්',    'UTF-8')    . "\n";
17
18print "Emoji (\u{1F418}): " . mb_strwidth("\u{1F418}", 'UTF-8') . "\n";
19
20// New in Unicode 15.0, width=2
21print "Emoji (\u{1F6DC}): " . mb_strwidth("\u{1F6DC}", 'UTF-8') . "\n";
22
23// Changed in Unicode 16.0, U+2630...U+2637 are wide
24print "Emoji (\u{2630}): " . mb_strwidth("\u{2630}", 'UTF-8') . "\n";
25
26echo "Char case changes:\n";
27
28print "Upper(\u{019b}) = \u{a7dc} : ";
29var_dump(mb_strtoupper("\u{019b}", 'UTF-8') === "\u{a7dc}");
30?>
31--EXPECT--
32Char widths:
33ASCII (PHP): 3
34Vietnamese (Xin chào): 8
35Traditional Chinese (你好): 4
36Sinhalese (අයේෂ්): 5
37Emoji (��): 2
38Emoji (��): 2
39Emoji (☰): 2
40Char case changes:
41Upper(ƛ) = Ƛ : bool(true)
42