import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / count_chars_variation2.php
blob71ea453947fcaa7191f279a49a6464a6cc4910e7
1 <?php
3 /* Prototype : mixed count_chars ( string $string [, int $mode ] )
4 * Description: Return information about characters used in a string
5 * Source code: ext/standard/string.c
6 */
8 echo "*** Testing count_chars() function: with unexpected inputs for 'mode' argument ***\n";
10 //get an unset variable
11 $unset_var = 'string_val';
12 unset($unset_var);
14 //defining a class
15 class sample {
18 // array with different values for $input
19 $inputs = array (
21 // integer values
22 /* 1 */ 0,
24 255,
25 2147483647,
26 -2147483648,
28 // float values
29 /* 6 */ 0.0,
30 1.3,
31 10.5,
32 -20.5,
33 10.1234567e10,
35 // array values
36 /* 11 */ array(),
37 array(1, 2, 3, 4, 5, 6, 7, 8, 9),
39 // boolean values
40 /* 14 */ true,
41 false,
42 TRUE,
43 FALSE,
45 // null values
46 /* 18 */ NULL,
47 null,
49 // string values
50 /* 20 */ "ABCD",
51 'abcd',
52 "1ABC",
53 "5ABC",
55 // objects
56 /* 24 */ new sample(),
58 // undefined variable
59 /* 25 */ @$undefined_var,
61 // unset variable
62 /* 26 */ @$unset_var
65 // loop through with each element of the $inputs array to test count_chars() function
66 // with unexepcted values for the 'mode' argument
67 $count = 1;
68 $string = "Return information about characters used in a string";
69 foreach($inputs as $input) {
70 echo "-- Iteration $count --\n";
71 // only list characters with a frequency > 0
72 var_dump(is_array(count_chars($string, $input)));
73 $count ++;
78 ===DONE===