Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

<?


//create test data
$Name = "Leon Atkinson";
$Email = "[email protected]";
$Residence = "Martinez";


$Info = array("Email", "Residence");


//start packet
$wddx = wddx_packet_start("Core PHP Programming");


//add some variables to the packet
wddx_add_vars($wddx, "Name", $Info);


//create packet
$packet = wddx_packet_end($wddx);


//print packet for demonstration purposes
print($packet);
?>


string wddx_serialize_value(value data, string comment)


The wddx_serialize_value function creates a WDDX packet containing a single
value. The data will be encoded with no name. The optional comment field will be added
to the packet as well.


<?


print(wddx_serialize_value("Hello, World",
"An example from Core PHP Programming"));
?>


string wddx_serialize_vars(string variable, ...)


Use wddx_serialize_vars to create a packet containing many variables. You may
specify any number of variable names in the local scope. Each argument may be a string
or an array. PHP will recursively explore multidimensional arrays for more names of
variables if necessary. A WDDX packet is returned.


<?


//create test data

Free download pdf