1--TEST--
2Test mb_strtoupper() function : usage varitations - Pass different character types to check conversion is correct
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7/*
8 * Pass characters from different languages to check that mb_strtoupper is
9 * doing a correct case conversion
10 */
11
12echo "*** Testing mb_strtoupper() : usage variations ***\n";
13
14$uppers = array('Basic Latin' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
15                'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
16                'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
17$lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
18                'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
19                'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
20
21foreach ($lowers as $lang => $sourcestring) {
22    echo "\n-- $lang --\n";
23    $a = mb_strtoupper($sourcestring, 'UTF-8');
24    var_dump(base64_encode($a));
25    if ($a == $uppers[$lang]) {
26        echo "Correctly Converted\n";
27    } else {
28        echo "Incorrectly Converted\n";
29    }
30}
31
32echo "Done";
33?>
34--EXPECT--
35*** Testing mb_strtoupper() : usage variations ***
36
37-- Basic Latin --
38string(36) "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo="
39Correctly Converted
40
41-- Characters With Accents --
42string(64) "w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=="
43Correctly Converted
44
45-- Russian --
46string(24) "0JDQkdCS0JPQlNCV0JbQlw=="
47Correctly Converted
48Done
49