xml_parser_free()

xml_parser_free() — Free an XML parser.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, 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.

The PHP manual marks this function as deprecated (since PHP 8.5): do not use it in new code.

What it does

In addition to calling xml_parser_free() when the parsing is finished, prior to PHP 8.0.0, it was necessary to also explicitly unset the reference to parser to avoid memory leaks, if the parser resource is referenced from an object, and this object references that parser resource.

Signature

xml_parser_free(XMLParser $parser): bool

Parameters

ParameterTypeWhat it takes
$parserXMLParserA reference to the XML parser to free.

Return value

Returns true on success or false on failure.

Example

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

Changelog

VersionChange
8.5.0This function has been deprecated.
8.0.0parser expects an XMLParser instance now; previously, a valid xml resource was expected.

All PHP 8.5 built-in functions

Reference card built from the PHP manual page xml_parser_free() (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.