1
0
mirror of https://github.com/php/php-src.git synced 2026-04-09 00:53:30 +02:00

Let settype also accept 'int', 'bool', 'float' and 'null'

@Let settype also accept 'int', 'bool', 'float' and 'null' (Jeroen)
This commit is contained in:
Jeroen van Wolffelaar
2001-09-22 01:39:14 +00:00
parent f8e78a00f2
commit 929ae94c64

View File

@@ -1443,7 +1443,11 @@ PHP_FUNCTION(settype)
if (!strcasecmp(new_type, "integer")) {
convert_to_long(*var);
} else if (!strcasecmp(new_type, "double")) {
} else if (!strcasecmp(new_type, "int")) {
convert_to_long(*var);
} else if (!strcasecmp(new_type, "float")) {
convert_to_double(*var);
} else if (!strcasecmp(new_type, "double")) { /* deprecated */
convert_to_double(*var);
} else if (!strcasecmp(new_type, "string")) {
convert_to_string(*var);
@@ -1451,8 +1455,12 @@ PHP_FUNCTION(settype)
convert_to_array(*var);
} else if (!strcasecmp(new_type, "object")) {
convert_to_object(*var);
} else if (!strcasecmp(new_type, "bool")) {
convert_to_boolean(*var);
} else if (!strcasecmp(new_type, "boolean")) {
convert_to_boolean(*var);
} else if (!strcasecmp(new_type, "null")) {
convert_to_null(*var);
} else if (!strcasecmp(new_type, "resource")) {
php_error(E_WARNING, "settype: cannot convert to resource type");
RETURN_FALSE;