How can an object be placed in an array?

Source: Internet
Author: User
Can an Object be put into an array? there is a static class method to return an Object using print_r to print for example: User & nbsp; Object & nbsp; (& nbsp; [UserID: private] & nbsp; = & gt; & nbsp; 1829 & nbsp; [can an object of UserInfoA be placed in an array?
There is a static method of the class that returns an object using print_r to print such:
User Object ([UserID: private] ==> 1829 [UserInfoArr: private] => Array ([UserName] => dong [UserPasswd] => 9d10b7eae72c5f1bb0b4fc1a68a34032 [Description] => AB [IsAuthEmail] => 0 [IsDelete] => 0 ))
Now I want to retrieve the UserName of the array in the object, but none of them can be successful. how can I read the value of the array in the object? Or can the object not have arrays? is this method (the object has arrays) incorrect?
------ Solution --------------------
You must first change the UserInfoArr attribute to a public attribute, rather than a private attribute that disables external access.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.