Return to rtrim_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test rtrim() function : basic functionality 3: --FILE-- 4: <?php 5: 6: /* Prototype : string rtrim ( string $str [, string $charlist ] ) 7: * Description: Strip whitespace (or other characters) from the end of a string. 8: * Source code: ext/standard/string.c 9: */ 10: 11: echo "*** Testing rtrim() : basic functionality ***\n"; 12: 13: $text = "---These are a few words--- \t\r\n\0\x0B "; 14: $hello = "!===Hello World===!"; 15: $alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 16: $binary = "Example string\x0A\x0D"; 17: 18: 19: 20: echo "\n-- Trim string with all white space characters --\n"; 21: var_dump(rtrim($text)); 22: 23: echo "\n-- Trim non-whitespace from a string --\n"; 24: var_dump(rtrim($hello, "=!")); 25: 26: echo "\n-- Trim some non-white space characters from a string --\n"; 27: var_dump(rtrim($hello, "!dlWro=")); 28: 29: echo "\n-- Trim some non-white space characters from a string using a character range --\n"; 30: var_dump(rtrim($alpha, "A..Z")); 31: 32: echo "\n-- Trim the ASCII control characters at the beginning of a string --\n"; 33: var_dump(rtrim($binary, "\x00..\x1F")); 34: 35: ?> 36: ===DONE=== 37: --EXPECT-- 38: *** Testing rtrim() : basic functionality *** 39: 40: -- Trim string with all white space characters -- 41: string(27) "---These are a few words---" 42: 43: -- Trim non-whitespace from a string -- 44: string(15) "!===Hello World" 45: 46: -- Trim some non-white space characters from a string -- 47: string(10) "!===Hello " 48: 49: -- Trim some non-white space characters from a string using a character range -- 50: string(10) "0123456789" 51: 52: -- Trim the ASCII control characters at the beginning of a string -- 53: string(14) "Example string" 54: ===DONE===