1--TEST-- 2Test mb_strtolower() function : usage variations - pass mixed ASCII and non-ASCII strings 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7/* 8 * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower 9 * to check correct conversion is occurring (Japanese characters should not be converted). 10 */ 11 12echo "*** Testing mb_strtolower() : usage variations ***\n"; 13 14$string_mixed = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=='); 15$string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=='); 16$string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC'); 17 18echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n"; 19$a = mb_strtolower($string_mixed, 'UTF-8'); 20var_dump(base64_encode($a)); 21if ($a == $string_mixed_lower) { 22 echo "Correctly Converted\n"; 23} else { 24 echo "Incorrectly Converted\n"; 25} 26 27echo "\n-- Multibyte Only String--\n"; 28$b = mb_strtolower($string_all_mb, 'UTF-8'); 29var_dump(base64_encode($b)); 30if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion 31 echo "Correctly Converted\n"; 32} else { 33 echo "Incorrectly Converted\n"; 34} 35 36echo "Done"; 37?> 38--EXPECT-- 39*** Testing mb_strtolower() : usage variations *** 40 41-- Mixed string (mulitbyte and ASCII characters) -- 42string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==" 43Correctly Converted 44 45-- Multibyte Only String-- 46string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC" 47Correctly Converted 48Done 49