Get an obj Value

Source: Internet
Author: User
There is an object in the following format: (xml format) [altLineId] & amp; gt; SimpleXMLElementObject ([0] & amp; gt; 651382441). You can get it all, but this is hard for me. There is an array under the object with an element key value named altLineId. Now I want to retrieve this 651382... there is an object as follows: (xml format)
[AltLineId] => SimpleXMLElement Object
(
[0] = & gt; 651382441
)

You can get the above information, but it's hard for me.
The object has an array with an element key value named altLineId.
Now I want to retrieve the 651382441

The methods are as follows:

$ A = $ tmp1 ['altlineid'] = $ spreadV ['altlineid'] [0]; // blank $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> 0; // error $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> [0]; // error $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> '0' // error $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> ['0'] // Error

Big solutions!

Reply content:

There is an object as follows: (xml format)
[AltLineId] => SimpleXMLElement Object
(
[0] = & gt; 651382441
)

You can get the above information, but it's hard for me.
The object has an array with an element key value named altLineId.
Now I want to retrieve the 651382441

The methods are as follows:

$ A = $ tmp1 ['altlineid'] = $ spreadV ['altlineid'] [0]; // blank $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> 0; // error $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> [0]; // error $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> '0' // error $ a = $ tmp1 ['altlineid'] = $ spreadV ['altlineid']-> ['0'] // Error

Big solutions!

$a = $tmp1['altLineId'] = $spreadV['altLineId']->{0}; 

I remember using SimpleXML for parsing.$spreadV->altLineIdYou can get the first value. If there are multiple values, useforeach($spreadV->altLineId as $lineId){}Okay. In addition, I want to spit out your tag. It is clear that the XML parsing result gives a JSONObject tag.

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.