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
| Parameter | Type | What it takes |
|---|---|---|
| $parser | XMLParser | A reference to the XML parser to set an option in. |
| $option | int | Which option to set. See below. |
| $value | string|int|bool | The 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
| Version | Change |
|---|---|
| 8.4.0 | Added the option XML_OPTION_PARSE_HUGE. |
| 8.3.0 | The value parameter now also accepts booleans. The options XML_OPTION_CASE_FOLDING and XML_OPTION_SKIP_WHITE are now 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 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.