Select Elements Which Have A Certain Attribute Value with simplexml

214 views Asked by At

I have this result when i do var_dump to $xml

`object(SimpleXMLElement)[257]
  public '@attributes' => 
    array (size=1)
      'seq' => string '290' (length=3)
  public 'FIN' => 
    object(SimpleXMLElement)[256]
      public '@attributes' => 
        array (size=1)
          'seq' => string '261' (length=3)
      public 'VAL' => string '1' (length=1)
      public 'ATT' => 
        array (size=11)
          0 => 
            object(SimpleXMLElement)[255]`

i need select with simplexml which seq have value 29

Thanks in advance

1

There are 1 answers

11
splash58 On

You can use xpath to find element with attribute 'seq' equal 29. Suppouse, $xml contains simplexml object then

$element = $xml->xpath('//*[@seq=29]');