1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Support resource type in gettype()

This commit is contained in:
Andi Gutmans
1999-08-01 17:56:09 +00:00
parent e2f17b298c
commit 91ec4763fd
2 changed files with 10 additions and 2 deletions

View File

@@ -1266,6 +1266,9 @@ PHP_FUNCTION(gettype)
case IS_LONG:
RETVAL_STRING("integer",1);
break;
case IS_RESOURCE:
RETVAL_STRING("resource",1);
break;
case IS_DOUBLE:
RETVAL_STRING("double",1);
break;
@@ -1318,6 +1321,11 @@ PHP_FUNCTION(settype)
convert_to_array(var);
} else if (!strcasecmp(new_type, "object")) {
convert_to_object(var);
} else if (!strcasecmp(new_type, "boolean")) {
convert_to_boolean(var);
} else if (!strcasecmp(new_type, "resource")) {
php3_error(E_WARNING, "settype: cannot convert to resource type");
RETURN_FALSE;
} else {
php3_error(E_WARNING, "settype: invalid type");
RETURN_FALSE;

View File

@@ -2,7 +2,7 @@
define("endl","\n");
if (1) {
//if (1) {
class foobar {
function foobar() {
$this->initialized = 1;
@@ -12,7 +12,7 @@ class foobar {
class barbara extends foobar {
};
}
//}
$name = "foobar";
$foo = new $name; // or die("Unable to construct foobar\n");