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...