wddx_packet_start

resource wddx_packet_start([string comment]) 

Starts a WDDX packet with optional comment.

Returns:

Packet ID

Description:

This functions creates a new, empty WDDX packet. It returns a packet ID for use in wddx_add_vars(), which lets you add variables to the packet. You can specify a string as an argument, which will be used as the comment for the packet.

Version:

Existing since versions 3.0.7 and 4.0

Example:

Create a WDDX packet
/* OUTPUT 
<wddxPacket version='1.0'> 
<header/> 
<data> 
<struct> 
<var name='foo'><string>FOO</string></var> 
</struct> 
</data> 
</wddxPacket> 
*/ 

// assign variable 
$foo = "FOO"; 

$id = wddx_packet_start(); 
wddx_add_vars($id, "foo"); 

// output packet 
print(wddx_packet_end($id)); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.