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