High score please tall man pointing stdClass Object to array
Please big brother pointing out, Google is not the answer to the post trouble everyone. High Score!
Problem:
I've got an array $array formatted with JSON 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
I want to get the array for
$array [0]=6000026492
$array [1]=6000026308
.................
How do I convert
Try not to use for, because the data is very much, call frequently, there is no best way to convert.
------Solution--------------------
Provide a clue: you send the JSON string, it is recommended to process the JSON string directly. For example, with some regular expressions or something, or simply str_replace.
------Solution--------------------
This post was last edited by xuzuning on 2011-07-27 08:29:46
You should be receiving JSON data like this.
$s = ' [{' num ': 123},{' num ': 456}] ';
$t = Json_decode ($s, 1);//decode to cast an array
Then the array is reduced to dimension
$p = Array_map (' current ', $t);
Finally connected to a string
echo implode (', ', $p);