Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<xml_parser_create_nsxml_parser_get_option>
^XML Parser FunctionsLast updated: Mon, 26 Oct 2026

xml_parser_free

(PHP 4, PHP 5, PHP 7, PHP 8)

xml_parser_free — Free an XML parser

Warning

This function has been DEPRECATED as of PHP 8.5.0. Relying on this function is highly discouraged.

Description

#[\Deprecated(
    since: '8.5',
    message: "as it has no effect since PHP 8.0",
)]

function xml_parser_free(XMLParser $parser): bool

Note:

This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource.

Frees the given XML parser.

Caution

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.

Parameters

parser

A reference to the XML parser to free.

Return Values

Returns true on success or false on failure.

Changelog

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

<xml_parser_create_nsxml_parser_get_option>
^XML Parser FunctionsLast updated: Mon, 26 Oct 2026