LinkedIn PHP Skill Quiz Assessment Answers

The following XML document is in books.xml. Which code will output “Historical”?

Latest Update on 29th December, 2021 by Certification Course Answers

The following XML document is in books.xml. Which code will output “Historical”?

  1. $books = simplexml_load_string(‘books.xml’); echo $books->book[0]->categories->category[1];
  2. $books = simplexml_load_file(‘books.xml’); echo $books->book[0]->categories->category[1];
  3. $books = SimpleXMLElement(‘books.xml’); echo $books->book[0]->categories->category[1];
  4. $books = SimpleXML(‘books.xml’); echo $books->book[0]->categories->category[1];

Correct Answer:

  • $books = SimpleXMLElement(‘books.xml’); echo $books->book[0]->categories->category[1];

Latest Updates

No posts found in this category.