Thats because the array contains a new Array of answers called ['Answers']
. So if you want to print each answer you get, you will have to do the following:
try
{
$answers = $yn->get_question(array('question_id'=>$question['id']));
//print out what you would like...All fields are location on this site http://developer.yahoo.com/answers/V1/getQuestion.html
foreach($answers['Answers'] as $answer)
{
print_r($answer['Content']);
echo "<hr>";
}
}
catch (Exception $e)
{
echo($e->getMessage());
}
E: When you dump an array with print_r()
or var_dump()
, alsways wrap up the result in pretags so you can easily see what's nested inside an new array etc.
echo "<pre>";
print_r($answers);
echo "</pre>";