xml_parser_set_option()

xml_parser_set_option() — Set options in 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_set_option(XMLParser $parser, int $option, string|int|bool $value): bool

Parameters

ParameterTypeWhat it takes
$parserXMLParserA reference to the XML parser to set an option in.
$optionintWhich option to set. See below.
$valuestring|int|boolThe option's new value.

Return value

Returns true on success or false on failure.

Example

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

Changelog

VersionChange
8.4.0Added the option XML_OPTION_PARSE_HUGE.
8.3.0The value parameter now also accepts booleans. The options XML_OPTION_CASE_FOLDING and XML_OPTION_SKIP_WHITE are now 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.

All PHP 8.5 built-in functions

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