Why does is_array() return false?

I have this SimpleXML object:

object(SimpleXMLElement)#176 (1) {
 ["record"]=>
 array(2) {
  [0]=>
  object(SimpleXMLElement)#39 (2) {
     ["f"]=>
     array(2) {
       [0]=>
       string(13) "stuff"
       [1]=>
       string(1) "1"
     }
  }
  [1]=>
  object(SimpleXMLElement)#37 (2) {
    ["f"]=>
    array(2) {
      [0]=>
      string(13) "more stuff"
      [1]=>
      string(3) "90"
    }
  }
}

Why does is_array($object->record) return false? It clearly says it's an array. Why can't I detect it using is_array?

Also, I am unable to cast it as an array using (array) $object->record. I get this error:

Warning: It is not yet possible to assign complex types to properties

Answers


SimpleXML nodes are objects that can contain other SimpleXML nodes. Use iterator_to_array().


Need Your Help

Classic asp with MSAccess database on godaddy server

ms-access iis asp-classic godaddy

I have a client, who bought godaddy's hosting service for his classic asp website.

AndroidManifest.xml processed output tool

android android-manifest adb android-sdk-tools

I'm going off a very vague memory, but there's a tool that is included in the Android SDK which, when you run it against an unsigned or a debug-signed application APK (I do not recall which), it ou...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.