xml_parser_get_option()

xml_parser_get_option() — Get options from 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.

Signature

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

Parameters

ParameterTypeWhat it takes
$parserXMLParserA reference to the XML parser to get an option from.
$optionintWhich option to fetch. XML_OPTION_CASE_FOLDING, XML_OPTION_PARSE_HUGE, XML_OPTION_SKIP_TAGSTART, XML_OPTION_SKIP_WHITE and XML_OPTION_TARGET_ENCODING are available. See xml_parser_set_option() for their description.

Return value

Returns the option's value.

Example

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

Changelog

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

All PHP 8.5 built-in functions

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