1--TEST-- 2Test get_resource_type() function : usage variations - different data types as handle arg 3--FILE-- 4<?php 5/* Prototype : string get_resource_type ( resource $handle ) 6 * Description: Returns the resource type 7 * Source code: Zend/zend_builtin_functions.c 8 */ 9 10echo "*** Testing get_resource_type() : variation test ***\n"; 11 12class Hello { 13 public function SayHello($arg) { 14 echo "Hello\n"; 15 } 16} 17 18$res = fopen(__FILE__, "r"); 19 20$vars = array( 21 "bool"=>true, 22 "int 10"=>10, 23 "float 10.5"=>10.5, 24 "string"=>"Hello World", 25 "array"=>array(1,2,3,4,5), 26 "NULL"=>NULL, 27 "Object"=>new Hello() 28); 29 30foreach($vars as $variation =>$object) { 31 echo "\n-- $variation --\n"; 32 var_dump(get_resource_type($object)); 33}; 34 35?> 36===DONE=== 37--EXPECTF-- 38*** Testing get_resource_type() : variation test *** 39 40-- bool -- 41 42Warning: get_resource_type() expects parameter 1 to be resource, boolean given in %s on line %d 43NULL 44 45-- int 10 -- 46 47Warning: get_resource_type() expects parameter 1 to be resource, integer given in %s on line %d 48NULL 49 50-- float 10.5 -- 51 52Warning: get_resource_type() expects parameter 1 to be resource, double given in %s on line %d 53NULL 54 55-- string -- 56 57Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d 58NULL 59 60-- array -- 61 62Warning: get_resource_type() expects parameter 1 to be resource, array given in %s on line %d 63NULL 64 65-- NULL -- 66 67Warning: get_resource_type() expects parameter 1 to be resource, null given in %s on line %d 68NULL 69 70-- Object -- 71 72Warning: get_resource_type() expects parameter 1 to be resource, object given in %s on line %d 73NULL 74===DONE===