user391986
user391986

Reputation: 30946

php xml get value of node

How can I get "bla" in the below dump of my node Essentially bla is what is contained in my node

<mynode name="myvalueone" display="myvalue2">bla</mynode>


object(SimpleXMLElement)[21]
  public '@attributes' => 
    array
      'name' => string 'myvalueone' (length=65)
      'display' => string 'myvalue2' (length=9)
  string 'bla' (length=3)

Upvotes: 0

Views: 1371

Answers (1)

Imi Borbas
Imi Borbas

Reputation: 3703

You can obtain the value by casting the SimpleXMLElement to a string like this: $value = (string)$element;

Upvotes: 1

Related Questions