PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/standard/tests/strings/strtolower-win32.php

http://github.com/facebook/hiphop-php
PHP | 52 lines | 38 code | 7 blank | 7 comment | 2 complexity | c4766da554c4d1705b3f976b0f4394ee MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. /* Prototype:
  3. string strtolower ( string $str );
  4. Description:
  5. Returns string with all alphabetic characters converted to lowercase.
  6. */
  7. echo "*** Testing strtolower() with all 256 chars ***\n";
  8. for ($i=0; $i<=255; $i++){
  9. $char = chr($i);
  10. print(bin2hex($char))." => ".(bin2hex(strtolower("$char")))."\n";
  11. }
  12. echo "*** Testing strlower() with basic strings ***\n";
  13. $str = "Mary Had A liTTle LAmb and ShE loveD IT So\n";
  14. var_dump(strtolower($str));
  15. echo "\n*** Testing strtolower() with various strings ***";
  16. /* strings to pass strtolower() */
  17. $strings = array (
  18. "",
  19. "string",
  20. "stRINg0234",
  21. "1.233.344StrinG12333",
  22. "$$$$$$!!!!@@@@@@@ ABCDEF !!!***",
  23. "ABCD\0abcdABCD",
  24. NULL,
  25. TRUE,
  26. FALSE,
  27. array()
  28. );
  29. $count = 0;
  30. /* loop through to check possible variations */
  31. foreach ($strings as $string) {
  32. echo "\n-- Iteration $count --\n";
  33. var_dump( strtolower($string) );
  34. $count++;
  35. }
  36. echo "\n*** Testing strtolower() with two different case strings ***\n";
  37. if (strtolower("HeLLo woRLd") === strtolower("hEllo WORLD"))
  38. echo "strings are same, with Case Insensitive\n";
  39. else
  40. echo "strings are not same\n";
  41. echo "\n*** Testing error conditions ***";
  42. var_dump( strtolower() ); /* Zero arguments */
  43. var_dump( strtolower("a", "b") ); /* Arguments > Expected */
  44. echo "*** Done ***";
  45. ?>