xml_set_end_namespace_decl_handler()

xml_set_end_namespace_decl_handler() — Set up end namespace declaration handler.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Set a handler to be called when leaving the scope of a namespace declaration. This will be called, for each namespace declaration, after the handler for the end tag of the element in which the namespace was declared.

Signature

xml_set_end_namespace_decl_handler(XMLParser $parser, callable|string|null $handler): true handler(XMLParser $parser, string|false $prefix)

Parameters

ParameterTypeWhat it takes
$parserXMLParserThe XML parser.
$handlercallable|string|nullIf null is passed, the handler is reset to its default state. Warning An empty string will also reset the handler, however this is deprecated as of PHP 8.4.0.

Return value

Always returns true.

Example

The PHP manual ships no example for xml_set_end_namespace_decl_handler(); the signature and the parameter table above are the contract.

Changelog

VersionChange
8.4.0Passing a non-callable string to handler is now deprecated, use a proper callable for methods, or null to reset the handler.
8.4.0The validity of handler as a callable is now checked when setting the handler instead of checking when calling it.
8.0.0parser expects an XMLParser instance now; previously, a valid xml resource was expected.

See also

xml_set_start_namespace_decl_handler()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page xml_set_end_namespace_decl_handler() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.