Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8005819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:19:23+00:00 2026-06-04T17:19:23+00:00

i am new to php. i need to do a task that convert xml

  • 0

i am new to php. i need to do a task that convert xml to array i search out a lot on the net and found lot of functions classes doing this for me but every function needs arguments which i don’t understand how to pass it the correct arguments. i need a function which take the xml of this link

  http://feeds.nytimes.com/nyt/rss/SundayBookReview

if you press ctrl+u it will give you the source it will b xml i need that xml through php and then convert it into an array please help me out.i am stuck

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:19:24+00:00Added an answer on June 4, 2026 at 5:19 pm

    this is what i use:

    <?php
    
    function xmlobj2arr($Data)
    {
       if (!isset($ret)) { $ret = array(); }
       if (is_object($Data))
          { foreach (get_object_vars($Data) as $key => $val) { $ret[$key] = xmlobj2arr($val); } return $ret; }
       elseif (is_array($Data)) {
          foreach ($Data as $key => $val) { $ret[$key] = xmlobj2arr($val); } return $ret;
       } else { return $Data; }
    }
    
    $thexml = new SimpleXMLElement( file_get_contents("http://feeds.nytimes.com/nyt/rss/SundayBookReview") );
    $arr = xmlobj2arr($thexml);
    echo "<pre>";
    print_r($arr);
    echo "</pre>";
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am really new in PHP and need a suggestion about array search. If
I am a bit new to PHP OOP so I need you guys help
Im new to JSON and php. I need to grab the lat and lng
We are in the startup build phase of a new PHP webapp that will
I am trying to pass an array as an argument to the new php
Im new to php and i want to find out in what file actually
Im new to PHP and I can't figure out what the rules are for
I'm new to PHP, so I need some guidance as to which would be
I have the following string: $/Mycollection/Branches/Dev/New/php/MySite/src/MySite/somefolder/src/sad.php I need to create regex pattern and take
I'm using PHP and I need help with a seemingly simple task with an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.