CakeFest 2024: The Official CakePHP Conference

wddx_add_vars

(PHP 4, PHP 5, PHP 7)

wddx_add_varsAjoute des variables à un paquet WDDX

Avertissement

Cette fonction est a été SUPPRIMÉE à partir de PHP 7.4.0.

Description

wddx_add_vars(resource $packet_id, mixed $var_name, mixed ...$var_names): bool

Sert à enregistrer et à ajouter les variables passées en argument au paquet repéré par son identifiant packet_id.

Liste de paramètres

Cette fonction prend un nombre variable de paramètres.

packet_id

Un paquet WDDX, retourné par la fonction wddx_packet_start().

var_name

Peut être une chaîne de caractères nommant une variable ou un tableau contenant des noms de variables ou d'autres tableaux, etc..

var_names

Valeurs de retour

Cette fonction retourne true en cas de succès ou false si une erreur survient.

add a note

User Contributed Notes 1 note

up
-1
maciek at webenlinea dot com
19 years ago
Here is a simple way of serializing dynamic values from an array:

<?PHP
//a unix timestamp
$date = "1094095513";

//some data to be included
$books = array('programming' => array('php','perl','java'),
'markup' => array('UML','XML','HTML')
);

//stick data to an array to iterate over
$data_to_serialize = array($date,$books);

//create the packet
$packet = wddx_packet_start("SOME DATA ARRAY");

//loop through the data
foreach($data_to_serialize as $key => $data)
{
//create a var whith the name of the content of $key
$$key = $data;
wddx_add_vars($packet,$key);
}

echo
wddx_packet_end($packet);

?>

Have fun !
To Top