Assuming this structure holds, you can get it with a simple foreach:
<?php
$consortiums = array();
foreach($arr as $arri)
array_push($consortiums,$arri['car']->consortiums);
print_r($consortiums);
?>
I’m iterating the array $arr (representing your array), ignoring the numerical indexes, and for each one I access the index car, that returns an object that has the member assortment, which in turn returns the final object.
I replicated your dump as follows:
<?php
$ob = new stdClass();
$ob->consortiums = new stdClass();
$ob->consortiums->i_am_a_consortium = "i am!";
$arr = array(
45 => array("car" => $ob),
92 => array("car" => $ob)
);
print_r($arr);
?>
Which produces an output similar to yours (I added only one member to the last object, so that we understand that they are the consortiums):
Array
(
[45] => Array
(
[car] => stdClass Object
(
[consortiums] => stdClass Object
(
[i_am_a_consortium] => i am!
)
)
)
[92] => Array
(
[car] => stdClass Object
(
[consortiums] => stdClass Object
(
[i_am_a_consortium] => i am!
)
)
)
)
And by testing the cycle, the output is:
Array
(
[0] => stdClass Object
(
[i_am_a_consortium] => i am!
)
[1] => stdClass Object
(
[i_am_a_consortium] => i am!
)
)
Which is an array of Consortium.
Your question is somewhat vague, and I can’t quite see exactly how you want the output, but you get an idea.
I don’t understand the code, is this a result of var_dump() ? your question may be how to take the two array ( with Dice 92 and 25 ) taken by the Dice of the first array would not solve ?
– SneepS NinjA
and that’s right, and I’m killing myself thinking I’d have to capture the array by those numbers. vlw
– Léo Soares Fontoura