rtrim_basic.phpt 1.3 KB

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