xml_parse
Function • Params and return types changed in PHP 8.0
Start parsing an XML document.
xml_parse Function synopsis
xml_parse(
XMLParser $parser,
string $data,
bool $is_final = false
): int
Parameters
$parser
TypeXMLParser
A reference to the XML parser to use.
$data
Typestring
Chunk of data to parse. A document may be parsed piece-wise by
calling xml_parse several times with new data,
as long as the $is_final parameter is set and
true when the last data is parsed.
$is_final
OptionalTypeboolDefault valuefalse
If set and true, $data is the last piece of
data sent in this parse.
Return value
Typeint
Returns 1 on success or 0 on failure.
For unsuccessful parses, error information can be retrieved with
xml_get_error_code,
xml_error_string,
xml_get_current_line_number,
xml_get_current_column_number and
xml_get_current_byte_index.
Some errors (such as entity errors) are reported at the end of the data, thus only if
[`$is_final`](#param-is_final) is set and `true`. Changes to the xml_parse Function
PHP 8.0
- Return type added:
int - Parameter type added for parameter #1 (
$parser):XMLParser - Parameter type added for parameter #2 (
$data):string - Parameter name of parameter #3 changed:
$isfinalto$is_final - Parameter type added for parameter #3 (
$is_final):bool - Parameter default value added for position #3 (
$is_final):false
xml_parse(
- $parser,
+ XMLParser $parser,
- $data,
+ string $data,
- $isfinal
+ bool $is_final = false
- )
+ ): int xml_parse Function Availability
xml_parse Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |