1--TEST-- 2Test is_a() function : usage variations - wrong type for arg 1 3--FILE-- 4<?php 5/* Prototype : proto bool is_a(object object, string class_name) 6 * Description: Returns true if the object is of this class or has this class as one of its parents 7 * Source code: Zend/zend_builtin_functions.c 8 * Alias to functions: 9 */ 10// Note: basic use cases in Zend/tests/is_a.phpt 11echo "*** Testing is_a() : usage variations ***\n"; 12 13// Initialise function arguments not being substituted (if any) 14$class_name = 'stdClass'; 15 16//get an unset variable 17$unset_var = 10; 18unset ($unset_var); 19 20//array of values to iterate over 21$values = array( 22 23 // int data 24 0, 25 1, 26 12345, 27 -2345, 28 29 // float data 30 10.5, 31 -10.5, 32 10.1234567e10, 33 10.7654321E-10, 34 .5, 35 36 // array data 37 array(), 38 array(0), 39 array(1), 40 array(1, 2), 41 array('color' => 'red', 'item' => 'pen'), 42 43 // null data 44 NULL, 45 null, 46 47 // boolean data 48 true, 49 false, 50 TRUE, 51 FALSE, 52 53 // empty data 54 "", 55 '', 56 57 // string data 58 "string", 59 'String', 60 61 // undefined data 62 $undefined_var, 63 64 // unset data 65 $unset_var, 66); 67 68// loop through each element of the array for object 69 70foreach($values as $value) { 71 echo @"\nArg value $value \n"; 72 var_dump( is_a($value, $class_name) ); 73}; 74 75echo "Done"; 76?> 77--EXPECTF-- 78*** Testing is_a() : usage variations *** 79 80Notice: Undefined variable: undefined_var in %s on line 59 81 82Notice: Undefined variable: unset_var in %s on line 62 83 84Arg value 0 85bool(false) 86 87Arg value 1 88bool(false) 89 90Arg value 12345 91bool(false) 92 93Arg value -2345 94bool(false) 95 96Arg value 10.5 97bool(false) 98 99Arg value -10.5 100bool(false) 101 102Arg value 101234567000 103bool(false) 104 105Arg value 1.07654321E-9 106bool(false) 107 108Arg value 0.5 109bool(false) 110 111Arg value Array 112bool(false) 113 114Arg value Array 115bool(false) 116 117Arg value Array 118bool(false) 119 120Arg value Array 121bool(false) 122 123Arg value Array 124bool(false) 125 126Arg value 127bool(false) 128 129Arg value 130bool(false) 131 132Arg value 1 133bool(false) 134 135Arg value 136bool(false) 137 138Arg value 1 139bool(false) 140 141Arg value 142bool(false) 143 144Arg value 145bool(false) 146 147Arg value 148bool(false) 149 150Arg value string 151bool(false) 152 153Arg value String 154bool(false) 155 156Arg value 157bool(false) 158 159Arg value 160bool(false) 161Done 162