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

(singke) #1

appropriate type. If the packet contains multiple values in a structure, an associative array
will be returned.


<?


//simulate WDDX packet
$packet = "";
$packet .= "";
$packet .= "Core PHP Programming";
$packet .= "
";
$packet .= "
";


//pull data out of packet
$data = wddx_deserialize($packet);


//test the type of the variable
if(is_array($data))
{
//loop over each value
foreach($data as $key=>$value)
{
print("$key: $value
\n");
}
}
else
{
//simply print the value
print("$data
\n");
}
?>


string wddx_packet_end(integer packet_identifier)


The wddx_packet_end function returns a string for the packet created with
wddx_packet_start and wddx_add_vars. See wddx_packet_start, below,
for an example of use.


integer wddx_packet_start(string comment)


The wddx_packet_start function returns an identifier to a WDDX packet you can
build as you go. The optional comment argument will be placed in the packet if
supplied. Use the returned packet identifier with wddx_add_vars and
wddx_packet_end.

Free download pdf