import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-general_functions / is_resource_basic.php
blob86945e222b6f3c6e7210d337ed0d89610f1491e1
1 <?php
2 /* Prototype : bool is_resource ( mixed $var )
3 * Description: Finds whether a variable is a resource
4 * Source code: ext/standard/type.c
5 */
7 echo "*** Testing is_resource() : basic functionality ***\n";
9 class Hello {
10 public function SayHello($arg) {
11 echo "Hello\n";
16 $vars = array(
17 false,
18 true,
19 10,
20 10.5,
21 "Helo World",
22 array(1,2,3,4,5),
23 NULL,
24 new Hello());
26 $types = array(
27 "bool=false",
28 "bool=true",
29 "integer",
30 "double",
31 "string",
32 "array",
33 "NULL",
34 "object");
36 echo "\nNon-resource type cases\n";
38 for ($i=0; $i < count($vars); $i++) {
39 if (is_resource($vars[$i])) {
40 echo $types[$i]. " test returns TRUE\n";
41 } else {
42 echo $types[$i]. " test returns FALSE\n";
46 $res = fopen(__FILE__, "r");
47 echo "\nResource type..var_dump after file open returns\n";
48 var_dump($res);
49 echo "Resource type..after file open is_resource() returns";
50 if (is_resource($res)) {
51 echo " TRUE\n";
52 } else {
53 echo " FALSE\n";
56 fclose($res);
57 echo "\nResource type..var_dump after file close returns\n";
58 var_dump($res);
59 echo "Resource type..after file close is_resource() returns";
60 if (is_resource($res)) {
61 echo " TRUE\n";
62 } else {
63 echo " FALSE\n";
68 ===DONE===