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/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding]) 11 * Description: Returns a lowercased version of $sourcestring 12 * Source code: ext/mbstring/mbstring.c 13 */ 14 15/* 16 * Pass accented characters and Russian characters to check case conversion is correct 17 */ 18 19echo "*** Testing mb_strtolower() : usage variations ***\n"; 20 21$uppers = array('Basic Latin' => b'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 22 'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='), 23 'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw==')); 24$lowers = array('Basic Latin' => b'abcdefghijklmnopqrstuvwxyz', 25 'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='), 26 'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw==')); 27 28foreach ($uppers as $lang => $sourcestring) { 29 echo "\n-- $lang --\n"; 30 $a = mb_strtolower($sourcestring, 'utf-8'); 31 var_dump(base64_encode($a)); 32 if ($a == $lowers[$lang]) { 33 echo "Correctly Converted\n"; 34 } else { 35 echo "Incorrectly Converted\n"; 36 } 37} 38 39echo "Done"; 40?> 41--EXPECTF-- 42*** Testing mb_strtolower() : usage variations *** 43 44-- Basic Latin -- 45string(36) "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=" 46Correctly Converted 47 48-- Characters With Accents -- 49string(64) "w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg==" 50Correctly Converted 51 52-- Russian -- 53string(24) "0LDQsdCy0LPQtNC10LbQtw==" 54Correctly Converted 55Done 56