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 !
wddx_add_vars
(PHP 4, PHP 5)
wddx_add_vars — Finaliza un paquete WDDX con el identificador dado
Descripcion
wddx_add_vars
( entero $packet_id
, varios-tipos $name_var
[, varios-tipos $...
] )
wddx_add_vars() se utiliza para serializar las variables dadas e incorporar el resultado al paquete especificado por packet_id . Las variables a serializar se especifican exactamente igual que en wddx_serialize_vars().
wddx_add_vars
maciek at webenlinea dot com
05-Sep-2004 11:20
05-Sep-2004 11:20
