PHP: Hypertext Preprocessor (original) (raw)

Change language:

xml_parser_get_option

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

xml_parser_get_option — Get options from an XML parser

Description

xml_parser_get_option(XMLParser $parser, int $option): string|int|bool

Gets an option value from an XML parser.

Parameters

parser

A reference to the XML parser to get an option from.

option

Which option to fetch. [XML_OPTION_CASE_FOLDING](xml.constants.php#constant.xml-option-case-folding),[XML_OPTION_PARSE_HUGE](xml.constants.php#constant.xml-option-parse-huge),[XML_OPTION_SKIP_TAGSTART](xml.constants.php#constant.xml-option-skip-tagstart), [XML_OPTION_SKIP_WHITE](xml.constants.php#constant.xml-option-skip-white) and [XML_OPTION_TARGET_ENCODING](xml.constants.php#constant.xml-option-target-encoding) are available. See xml_parser_set_option() for their description.

Return Values

Returns the option's value.

Errors/Exceptions

Throws a ValueError when an invalid value is passed to option.

Prior to PHP 8.0.0, passing an invalid value tooption generated a [E_WARNING](errorfunc.constants.php#constant.e-warning) as well as making the function return [false](reserved.constants.php#constant.false).

Changelog

Version Description
8.3.0 The function now returns a boolean for boolean options.
8.0.0 parser expects an XMLParser instance now; previously, a valid xml resource was expected.
8.0.0 A ValueError is now thrown ifoption is invalid.
7.1.24, 7.2.12, 7.3.0 options now supports XML_OPTION_SKIP_TAGSTART and XML_OPTION_SKIP_WHITE.

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug

+add a note

User Contributed Notes

There are no user contributed notes for this page.