note 81711 added to language.types.object
| From: | harmor at osu1 dot php dot net | Date: | Mon, 10 Mar 2008 20:17:29 +0000 |
| Subject: | note 81711 added to language.types.object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136913@lists.php.net to get a copy of this message | ||
Environment: PHP/5.2.5
Note that multi-dimentional arrays are not converted to objects, only the first level is like this:
Input:
<?php
$arr = array('nameOfAKey'=>array('subKeyName'=>'itsValue'));
$obj = (object)$arr;
echo '01: '.print_r($obj->nameOfAKey, true).'<br />'; //As expected
echo '02: Test: ('.var_export($obj->nameOfAKey->subKeyName,true).')'
//Not supported
?>
Output:
01: Array ( [subKeyName] => itsValue )
02: Test: (NULL)
----
Server IP: 69.147.83.197
Probable Submitter: 66.27.49.42
----
Manual Page -- http://www.php.net/manual/en/language.types.object.php
Edit -- https://master.php.net/note/edit/81711
Del: integrated -- https://master.php.net/note/delete/81711/integrated
Del: useless -- https://master.php.net/note/delete/81711/useless
Del: bad code -- https://master.php.net/note/delete/81711/bad+code
Del: spam -- https://master.php.net/note/delete/81711/spam
Del: non-english -- https://master.php.net/note/delete/81711/non-english
Del: in docs -- https://master.php.net/note/delete/81711/in+docs
Del: other reasons-- https://master.php.net/note/delete/81711
Reject -- https://master.php.net/note/reject/81711
Search -- https://master.php.net/manage/user-notes.php