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