ltrim_basic.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test ltrim() function : basic functionality
  3. --FILE--
  4. <?php
  5. echo "*** Testing ltrim() : basic functionality ***\n";
  6. $text = " \t\r\n\0\x0B ---These are a few words--- ";
  7. $hello = "!===Hello World===!";
  8. $binary = "\x09\x0AExample string";
  9. $alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  10. echo "\n-- Trim string with all white space characters --\n";
  11. var_dump(ltrim($text));
  12. echo "\n-- Trim non-whitespace from a string --\n";
  13. var_dump(ltrim($hello, "=!"));
  14. echo "\n-- Trim some non-white space characters from a string --\n";
  15. var_dump(ltrim($hello, "!oleH="));
  16. echo "\n-- Trim some non-white space characters from a string suing a character range --\n";
  17. var_dump(ltrim($alpha, "A..Z"));
  18. echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
  19. var_dump(ltrim($binary, "\x00..\x1F"));
  20. ?>
  21. --EXPECT--
  22. *** Testing ltrim() : basic functionality ***
  23. -- Trim string with all white space characters --
  24. string(29) "---These are a few words--- "
  25. -- Trim non-whitespace from a string --
  26. string(15) "Hello World===!"
  27. -- Trim some non-white space characters from a string --
  28. string(10) " World===!"
  29. -- Trim some non-white space characters from a string suing a character range --
  30. string(10) "0123456789"
  31. -- Trim the ASCII control characters at the beginning of a string --
  32. string(14) "Example string"