Small questions about the array of images

Source: Internet
Author: User
Small problem with array objects. Print_r ($ GLOBALS [$ class]); the output result is as follows: ot_cod_feeObject (& nbsp; [title] & gt; cash payment service fee & nbsp; [output] & gt; array & nbsp; (& nbsp;) & nbsp; [code] & gt; small problem with Array object.
Print_r ($ GLOBALS [$ class]);
The output result is as follows:
Ot_cod_jsonobject
(
[Title] => cash payment service fee
[Output] => Array
(
)
[Code] => ot_cod_fee
)
Ot_total Object
(
[Title] => Total
[Output] => Array
(
)
[Code] => ot_total
)

I want to add a new entry in this array object. how can I write it?
$ GLOBALS ['test'] = array ('title' => 'logistic', 'output' => array (), 'code' => 'ot _ logistics ');
In this way, the array is added, and how to add the image.

------ Solution --------------------
Discussion

$ Arr = (object) array ('title' => 'logistic', 'output' => array (), 'code' => 'ot _ logistics ');
How do I customize the object name?

------ Solution --------------------
PHP code
Class object_name {} $ p = new object_name; $ ar = array ('title' => 'logistic', 'output' => array (), 'code' => 'ot _ logistics ', 'description' => 'logistic', 'sort _ order' => 888 ); foreach ($ ar as $ k = >$ v) $ p-> $ k = $ v; print_r ($ p );

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.