mb_strtolower_basic.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Test mb_strtolower() function : basic functionality
  3. --SKIPIF--
  4. <?php
  5. extension_loaded('mbstring') or die('skip');
  6. function_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. * Test basic functionality of mb_strtolower
  16. */
  17. echo "*** Testing mb_strtolower() : basic functionality***\n";
  18. $ascii_lower = 'abcdefghijklmnopqrstuvwxyz';
  19. $ascii_upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  20. $greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
  21. $greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
  22. echo "\n-- ASCII String --\n";
  23. $ascii = mb_strtolower($ascii_upper);
  24. var_dump($ascii);
  25. if($ascii == $ascii_lower) {
  26. echo "Correctly converted\n";
  27. } else {
  28. echo "Incorrectly converted\n";
  29. }
  30. echo "\n-- Multibyte String --\n";
  31. $mb = mb_strtolower($greek_upper, 'UTF-8');
  32. var_dump(base64_encode($mb));
  33. if ($mb == $greek_lower) {
  34. echo "Correctly converted\n";
  35. } else {
  36. echo "Incorreclty converted\n";
  37. }
  38. echo "Done";
  39. ?>
  40. --EXPECTF--
  41. *** Testing mb_strtolower() : basic functionality***
  42. -- ASCII String --
  43. string(26) "abcdefghijklmnopqrstuvwxyz"
  44. Correctly converted
  45. -- Multibyte String --
  46. string(64) "zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J"
  47. Correctly converted
  48. Done