import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / rtrim.php
blobcac8c0476369a82995162b1d52d214fe4adef5d3
1 <?php
3 /* Testing for Error conditions */
5 /* Invalid Number of Arguments */
7 echo "\n *** Output for Error Conditions ***\n";
8 rtrim();
9 rtrim("", " ", 1);
11 /* Testing the Normal behaviour of rtrim() function */
13 echo "\n *** Output for Normal Behaviour ***\n";
14 var_dump ( rtrim("rtrim test \t\0 ") ); /* without second Argument */
15 var_dump ( rtrim("rtrim test " , "") ); /* no characters in second Argument */
16 var_dump ( rtrim("rtrim test ", NULL) ); /* with NULL as second Argument */
17 var_dump ( rtrim("rtrim test ", true) ); /* with boolean value as second Argument */
18 var_dump ( rtrim("rtrim test ", " ") ); /* with single space as second Argument */
19 var_dump ( rtrim("rtrim test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
20 var_dump ( rtrim("rtrim testABCXYZ", "A..Z") ); /* with characters range as second Argument */
21 var_dump ( rtrim("rtrim test0123456789", "0..9") ); /* with numbers range as second Argument */
22 var_dump ( rtrim("rtrim test$#@", "#@$") ); /* with some special characters as second Argument */
25 /* Use of class and objects */
26 echo "\n*** Checking with OBJECTS ***\n";
27 class string1 {
28 public function __toString() {
29 return "Object";
32 $obj = new string1;
33 var_dump( rtrim($obj, "tc") );
35 /* String with embedded NULL */
36 echo "\n*** String with embedded NULL ***\n";
37 var_dump( rtrim("234\x0005678\x0000efgh\xijkl\x0n1", "\x0n1") );
39 /* heredoc string */
40 $str = <<<EOD
42 ing heredoc string
43 EOD;
45 echo "\n *** Using heredoc string ***\n";
46 var_dump( rtrim($str, "ing") );
48 echo "Done\n";