High score please instruct stdClassObject to convert array

Source: Internet
Author: User
For high scores, please kindly advise stdClassObject to convert the array and ask your eldest brother to give me some advice. if Google doesn't get the answer, I will post it to you. for high scores!
Problem:
The format of an array $ array obtained from json is as follows:
Array(    [0] => stdClass Object        (            [num_iid] => 6000026492        )     [1] => stdClass Object        (            [num] => 6000026308        )     [2] => stdClass Object        (            [num] => 6000025528        )     [3] => stdClass Object        (            [num] => 6000025650        )     [4] => stdClass Object        (            [num] => 6000027082

The array I want to get is
$ Array [0] = 6000026492
$ Array [1] = 6000026308
.................
How to Convert
Do not use for as much as possible, because there is a lot of data and frequent calls, there is no best way to convert.




Reply to discussion (solution)

After the conversion, I can use implode ("," $ array) to get the final result string: 6000026492,600 0026308 .....
Is there a one-step method for direct conversion?

Array(    [0] => stdClass Object        (            [num_iid] => 6000026492        )     [1] => stdClass Object.........
To 6000026492,600 0026308 .....

Nobody answered?
No one answered. another sleep night tonight

Provide an idea: you can send the json string. we recommend that you process the json string directly. For example, use a regular expression or str_replace.

Provide an idea: you can send the json string. we recommend that you process the json string directly. For example, use a regular expression or str_replace.
Thank you.

// What you receive should be json data like this
$ S = '[{"num": 123 },{ "num": 456}]';
$ T = json_decode ($ s, 1); // The decoded struct is forcibly converted to an array.
// Then dimension the array
$ P = array_map ('stream', $ t );
// Connect to the string
Echo implode (',', $ p );

// What you receive should be json data like this
$ S = '[{"num": 123 },{ "num": 456}]';
$ T = json_decode ($ s, 1); // The decoded struct is forcibly converted to an array.
// Then dimension the array
$ P = array_map ('stream', $ t );
// Connect to the string
Echo implode (',', $ p );
Is it difficult to decode the object directly as a JSON object...

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.