import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-class_object / interface_exists_variation1.php
blob73a2cf9c299f780cc7dcbe62c9598f2a72c92baf
1 <?php
2 /* Prototype : bool interface_exists(string classname [, bool autoload])
3 * Description: Checks if the class exists
4 * Source code: Zend/zend_builtin_functions.c
5 * Alias to functions:
6 */
8 echo "*** Testing interface_exists() : usage variation ***\n";
10 // Initialise function arguments not being substituted (if any)
11 $autoload = true;
13 //get an unset variable
14 $unset_var = 10;
15 unset ($unset_var);
17 // define some classes
18 class classWithToString
20 public function __toString() {
21 return "Class A object";
25 class classWithoutToString
29 // heredoc string
30 $heredoc = <<<EOT
31 hello world
32 EOT;
34 // add arrays
35 $index_array = array (1, 2, 3);
36 $assoc_array = array ('one' => 1, 'two' => 2);
38 //array of values to iterate over
39 $inputs = array(
41 // int data
42 'int 0' => 0,
43 'int 1' => 1,
44 'int 12345' => 12345,
45 'int -12345' => -2345,
47 // float data
48 'float 10.5' => 10.5,
49 'float -10.5' => -10.5,
50 'float 12.3456789000e10' => 12.3456789000e10,
51 'float -12.3456789000e10' => -12.3456789000e10,
52 'float .5' => .5,
54 // array data
55 'empty array' => array(),
56 'int indexed array' => $index_array,
57 'associative array' => $assoc_array,
58 'nested arrays' => array('foo', $index_array, $assoc_array),
60 // null data
61 'uppercase NULL' => NULL,
62 'lowercase null' => null,
64 // boolean data
65 'lowercase true' => true,
66 'lowercase false' =>false,
67 'uppercase TRUE' =>TRUE,
68 'uppercase FALSE' =>FALSE,
70 // empty data
71 'empty string DQ' => "",
72 'empty string SQ' => '',
74 // object data
75 'instance of classWithToString' => new classWithToString(),
76 'instance of classWithoutToString' => new classWithoutToString(),
78 // undefined data
79 'undefined var' => @$undefined_var,
81 // unset data
82 'unset var' => @$unset_var,
85 // loop through each element of the array for classname
87 foreach($inputs as $key =>$value) {
88 echo "\n--$key--\n";
89 var_dump( interface_exists($value, $autoload) );
93 ===DONE===