Two-dimensional array simplexmlelement Object converted to normal two-dimensional array

Source: Internet
Author: User
The following is the output of a two-dimensional array with SimpleXMLElement object, how can the inside of the SimpleXMLElement object all removed into a normal two-dimensional array.

Array ([0] = SimpleXMLElement Object ([Favtype] = 2 [freesum] = [freecurrent] = 965 [FavCode1] =&gt ; 1 [FavCode2] = 4 [Favofferinfo] + 201407 enjoy 4G 299 RMB package)
[1] = = SimpleXMLElement Object ([Favtype] = 2 [freesum] [freecurrent] = [FavCode1] = 1 [favco DE2] + 2 [favofferinfo] = 201407 Enjoy 4G 299 RMB package)
[2] = = SimpleXMLElement Object ([Favtype] = 3 [Freesum] = [freecurrent] = [FavCode1] = 4 [favcod E2] + 8 [favofferinfo] + Tianyi-group 0 yuan 30M back flow packet)
[3] = = SimpleXMLElement Object ([Favtype] = 3 [Freesum] = [freecurrent] = [FavCode1] = 4 [favcod E2] + 8 [favofferinfo] + Sky Wing customer service gift 30M in-province traffic pack)
[4] = = SimpleXMLElement Object ([Favtype] = 3 [freesum] = 4096 [freecurrent] = 1857.32 [FavCode1] = 4 [FavCode2] = 8 [Favofferinfo] + 201407 enjoy 4G 299 RMB package))


Reply to discussion (solution)

function Objecttoarray ($o) {  if (Is_object ($o)) $o = Get_object_vars ($o);  if (Is_array ($o))     foreach ($o as $k = = $v) $o [$k] = Objecttoarray ($v);  return $o;}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.