PHP: wddx_add_vars - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

wddx_deserialize WDDX

Last updated: Fri, 26 Jan 2007

view this page in

# wddx_add_vars

(PHP 3 >= 3.0.7, PHP 4, PHP 5)

wddx_add_vars -- Add variables to a WDDX packet with the specified ID

## Description

bool wddx_add_vars ( int packet_id, mixed name_var [, mixed ...] )

wddx_add_vars() is used to serialize passed variables and add the result to the packet specified by the `packet_id`. The variables to be serialized are specified in exactly the same way as wddx_serialize_vars().

add a note User Contributed Notes
wddx_add_vars
maciek at webenlinea dot com
05-Sep-2004 11:20
`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 !`
add a note
wddx_deserialize WDDX

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 11:33:19 2007 PST