From 2927fdd59938f9e9a3569860120d7b4885d3de18 Mon Sep 17 00:00:00 2001 From: Tjerk Anne Meesters Date: Tue, 25 Nov 2014 23:25:55 +0000 Subject: [PATCH] Added a note about array to object casting git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335216 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/types/object.xml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/language/types/object.xml b/language/types/object.xml index e0f566f92d..c78737e17a 100644 --- a/language/types/object.xml +++ b/language/types/object.xml @@ -45,9 +45,26 @@ $bar->do_foo(); modified. If a value of any other type is converted to an object, a new instance of the stdClass built-in class is created. If the value was &null;, the new instance will be - empty. Arrays convert to an object with properties - named by keys, and corresponding values. For any other value, a member - variable named scalar will contain the value. + empty. An array converts to an object with properties + named by keys and corresponding values, with the exception of numeric keys which + will be inaccessible unless iterated. + + + + + 'foo'); +var_dump(isset($obj->{'1'})); // outputs 'bool(false)' +var_dump(key($obj)); // outputs 'int(1)' +?> +]]> + + + + + For any other value, a member variable named scalar will contain + the value.