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