xml_parse_into_struct

FunctionReturn type changed in PHP 8.1

Parse XML data into an array structure.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Improved
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

xml_parse_into_struct Function synopsis

xml_parse_into_struct(
    XMLParser $parser,
    string $data,
    &$values,
    &$index = null
  ): int|false

Parameters

$parser

TypeXMLParser

A reference to the XML parser.

$data

Typestring

A string containing the XML data.

$values

Passed by reference

An array containing the values of the XML data

$index

Passed by reference, OptionalDefault valuenull

An array containing pointers to the location of the appropriate values in the $values.

Note that the parameters $values and $index are passed by reference, and contain additional/updated context data that may be useful.

Return value

Typeint|false

xml_parse_into_struct returns 0 for failure and 1 for success. This is not the same as false and true, be careful with operators such as ===.

Changes to the xml_parse_into_struct Function

PHP 8.1

  • Return type changed: int to int|false
  xml_parse_into_struct(
      XMLParser $parser,
      string $data,
      &$values,
      &$index = null
-   ): int
+   ): int|false

PHP 8.0

  • Return type added: int
  • Parameter type added for parameter #1 ($parser): XMLParser
  • Parameter type added for parameter #2 ($data): string
  • Parameter default value added for position #4 ($index): null
  xml_parse_into_struct(
-     $parser,
+     XMLParser $parser,
-     $data,
+     string $data,
      &$values,
-     &$index
+     &$index = null
-   )
+   ): int

xml_parse_into_struct Function Availability

PHP VersionAvailability
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