Documentation du code de SPIP et de ses plugins

Boussole

decoder_xml.php

Ce fichier contient la fonction surchargeable de transformation d'un XML en tableau PHP.

Cette fonction utilise les fonctions d'encodage et décodage JSON.

Table of Contents

inc_decoder_xml_dist()  : array<string|int, mixed>
Transformation d'un texte XML en tableau PHP.

Functions

inc_decoder_xml_dist()

Transformation d'un texte XML en tableau PHP.

inc_decoder_xml_dist(string $xml) : array<string|int, mixed>

L'argument XML est un texte: il est au préalable converti en objet SimpleXML par la fonction simplexml_load_string(). Ensuite, c'est l'objet SimpleXML qui est traduit en tableau PHP à partir des fonctions json_encode et json_decode.

Parameters
$xml : string

XML à phraser et à transformer en tableau PHP. Le XML est fourni comme une chaine de caractères représentant le texte XML lui-même.

Tags
example
$page = recuperer_url($action)['page'] ?? null;
$convertir = charger_fonction('decoder_xml', 'inc');
$tableau = $convertir($page);
Return values
array<string|int, mixed>

Search results