import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / rtrim_variation1.php
blob77efa67b9c357bac6f8e55a3faf4015fc613df19
1 <?php
3 /* Prototype : string rtrim ( string $str [, string $charlist ] )
4 * Description: Strip whitespace (or other characters) from the end of a string.
5 * Source code: ext/standard/string.c
6 */
8 echo "*** Testing rtrim() function: with unexpected inputs for 'str' argument ***\n";
10 //get an unset variable
11 $unset_var = ' !--string_val--! ';
12 unset($unset_var);
14 //defining a class
15 class sample {
16 public function __toString() {
17 return " !---sample object---! ";
21 //getting the resource
22 $file_handle = fopen(__FILE__, "r");
24 // array with different values for $input
25 $inputs = array (
27 // integer values
28 /*1*/ 0,
30 255,
31 256,
32 2147483647,
33 -2147483648,
35 // float values
36 /*7*/ 10.5,
37 -20.5,
38 10.1234567e10,
40 // array values
41 /*10*/ array(),
42 array(0),
43 array(1, 2),
45 // boolean values
46 /*13*/ true,
47 false,
48 TRUE,
49 FALSE,
51 // null values
52 /*17*/ NULL,
53 null,
55 // objects
56 /*19*/ new sample(),
58 // resource
59 /*20*/ $file_handle,
61 // undefined variable
62 /*21*/ @$undefined_var,
64 // unset variable
65 /*22*/ @$unset_var
68 // loop through with each element of the $inputs array to test rtrim() function
69 $count = 1;
70 foreach($inputs as $input) {
71 echo "-- Iteration $count --\n";
72 // strip white space and any "minus" signs
73 var_dump( rtrim($input, " !-") );
74 $count ++;
77 fclose($file_handle); //closing the file handle
80 ===DONE===