Creation of WDDX packets is just as simple as parsing.

<?php
class foo {
    var 
$bar;

    function 
foo()
    {
        
$this->bar 1;
    }
}

    
$a 1$b = array(1,2,3); $c = new foo();

    
// create a new wddx packet, with description
    
$p_id wddx_packet_start("My PHP Packet");
    
    
// append variables to wddx packet
    
wddx_add_vars($p_id'a''b''c');

    
// finalize & serialize the packet
    
$wddx_packet wddx_packet_end($p_id);

    echo 
$wddx_packet;
?>
<wddxPacket version='1.0'>
  <header>
    <comment>My PHP Packet</comment>
  </header>
  <data>
    <struct>
      <var name='a'>
        <number>1</number>
      </var>
      <var name='b'>
        <array length='3'>
          <number>1</number>
          <number>2</number>
          <number>3</number>
        </array>
      </var>
      <var name='c'>
        <struct>
          <var name='php_class_name'>
            <string>foo</string>
          </var>
          <var name='bar'>
            <number>1</number>
          </var>
        </struct>
      </var>
    </struct>
  </data>
</wddxPacket>