For this array
stdClass Object
(
[YearsResult] => stdClass Object
(
[years] => stdClass Object
(
[year] => Array
(
[0] => 2013
[1] => 2012
[2] => 2011
[3] => 2010
[4] => 2009
[5] => 2008
[6] => 2007
[7] => 2006
[8] => 2005
[9] => 2004
[10] => 2003
[11] => 2002
[12] => 2001
[13] => 2000
[14] => 1999
[15] => 1998
)
)
)
)
What is the correct method for running a foreach loop to get the year values? I have tried every conceivable method I can find/think, and my last attempt was
foreach ($result->YearsResult->years->year as $test) {
echo $test->year;
}
which returns nothing.