array_filter in array inside SimpleXML object

2

I have the following object:

object(SimpleXMLElement)#2 (1) {
["cinema"]=>
  array(82) {
[0]=>
object(SimpleXMLElement)#4 (11) {
  ["@attributes"]=>
  array(2) {
    ["id"]=>
    string(3) "716"
    ["grupo-economico"]=>
    string(8) "Cinemark"
  }
  ["nome"]=>
  string(10) "Aricanduva"
  ["nome-amigavel"]=>
  string(10) "aricanduva"
  ["venda-internet"]=>
  string(5) "false"
  ["endereco"]=>
  object(SimpleXMLElement)#86 (1) {
    ["@attributes"]=>
    array(2) {
      ["latitude"]=>
      string(9) "-23.56582"
      ["longitude"]=>
      string(9) "-46.50364"
    }
  }
  ["precos"]=>
  object(SimpleXMLElement)#87 (0) {
  }
...

I'm trying to access array ["cinema"] to use it in array_filter but when I access it I get only NULL .

$xml->complexos // Retorna a estrutura acima
$xml->complexos["cinema"] // NULL
$xml->complexos->cinema // Retorna apenas o primeiro elemento do array

** Important: I know it works with foreach but I need to use array_filter to make the code as simple and readable as possible.

    
asked by anonymous 03.04.2017 / 19:01

0 answers