The SimpleXMLElement class

(PHP 5, PHP 7, PHP 8)

Introduction

Represents an element in an XML document.

Class synopsis

classSimpleXMLElementimplementsStringable, Countable, RecursiveIterator {
public__construct(
    string$data,
    int$options = 0,
    bool$dataIsURL = false,
    string$namespaceOrPrefix = "",
    bool$isPrefix = false
)
publicaddAttribute(string$qualifiedName, string$value, ?string$namespace = null): void
publicaddChild(string$qualifiedName, ?string$value = null, ?string$namespace = null): ?SimpleXMLElement
publicasXML(?string$filename = null): string|bool
publicattributes(?string$namespaceOrPrefix = null, bool$isPrefix = false): ?SimpleXMLElement
publicchildren(?string$namespaceOrPrefix = null, bool$isPrefix = false): ?SimpleXMLElement
publiccount(): int
publicgetDocNamespaces(bool$recursive = false, bool$fromRoot = true): array|false
publicgetName(): string
publicgetNamespaces(bool$recursive = false): array
publichasChildren(): bool
publickey(): string
publicnext(): void
publicregisterXPathNamespace(string$prefix, string$namespace): bool
publicrewind(): void
publicvalid(): bool
publicxpath(string$expression): array|null|false
}

Changelog

VersionDescription
8.0.0SimpleXMLElement implements Stringable, Countable, and RecursiveIterator now.

Table of Contents

To Top