import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-class_object / is_subclass_of_variation_004.php
blobbc2dbd0590e05f01eb80257f9cb2169527f9ea22
1 <?php
2 /* Prototype : proto bool is_subclass_of(object object, string class_name)
3 * Description: Returns true if the object has this class as one of its parents
4 * Source code: Zend/zend_builtin_functions.c
5 * Alias to functions:
6 */
7 // Note: basic use cases in Zend/tests/is_a.phpt
8 function __autoload($className) {
9 echo "In __autoload($className)\n";
12 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
13 echo "Error: $err_no - $err_msg, $filename($linenum)\n";
15 set_error_handler('test_error_handler');
18 echo "*** Testing is_subclass_of() : usage variations ***\n";
20 // Initialise function arguments not being substituted (if any)
21 $class_name = 'stdClass';
23 //get an unset variable
24 $unset_var = 10;
25 unset ($unset_var);
27 //array of values to iterate over
28 $values = array(
30 // int data
33 12345,
34 -2345,
36 // float data
37 10.5,
38 -10.5,
39 10.1234567e10,
40 10.7654321E-10,
41 .5,
43 // array data
44 array(),
45 array(0),
46 array(1),
47 array(1, 2),
48 array('color' => 'red', 'item' => 'pen'),
50 // null data
51 NULL,
52 null,
54 // boolean data
55 true,
56 false,
57 TRUE,
58 FALSE,
60 // empty data
61 "",
62 '',
64 // string data
65 "string",
66 'String',
68 // undefined data
69 $undefined_var,
71 // unset data
72 $unset_var,
75 // loop through each element of the array for object
77 foreach($values as $value) {
78 echo "\nArg value $value \n";
79 var_dump( is_subclass_of($value, $class_name) );
82 echo "Done";