Abscissa Tech Home Design Coding Media Server
Tutorials Courses Forums Resources
  Home
 
  Member Options
    Sign Up
  Log In
 
  Tools
    PowerHTML
    Teacher's Lounge
  References
  HTML
  PHP
  CSS
 
  Search
 
 
    Legalese
    Contact Us
    Privacy Policy
    About Abscissa

LV. WDDX functions

These functions are intended for work with WDDX.

Note that all the functions that serialize variables use the first element of an array to determine whether the array is to be serialized into an array or structure. If the first element has string key, then it is serialized into a structure, otherwise, into an array.

Example 1. Serializing a single value

  1 
  2 <?php
  3 print wddx_serialize_value("PHP to WDDX packet example", "PHP packet");
  4 ?>
  5      

This example will produce:

  1 
  2 <wddxPacket version='0.9'><header comment='PHP packet'/><data>
  3 <string>PHP to WDDX packet example</string></data></wddxPacket>
  4      

Example 2. Using incremental packets

  1 
  2 <?php
  3 $pi = 3.1415926;
  4 $packet_id = wddx_packet_start("PHP");
  5 wddx_add_vars($packet_id, "pi");
  6 
  7 /* Suppose $cities came from database */
  8 $cities = array("Austin", "Novato", "Seattle");
  9 wddx_add_vars($packet_id, "cities");
 10 
 11 $packet = wddx_packet_end($packet_id);
 12 print $packet;
 13 ?>
 14      

This example will produce:

  1 
  2 <wddxPacket version='0.9'><header comment='PHP'/><data><struct>
  3 <var name='pi'><number>3.1415926</number></var><var name='cities'>
  4 <array length='3'><string>Austin</string><string>Novato</string>
  5 <string>Seattle</string></array></var></struct></data></wddxPacket>
  6      

Table of Contents
wddx_serialize_value — Serialize a single value into a WDDX packet
wddx_serialize_vars — Serialize variables into a WDDX packet
wddx_packet_start — Starts a new WDDX packet with structure inside it
wddx_packet_end — Ends a WDDX packet with the specified ID
wddx_add_vars — Ends a WDDX packet with the specified ID
wddx_deserialize — Deserializes a WDDX packet

This PHP manual is Copyright © 1997, 1998, 1999, 2000 the PHP Documentation Group. It has been licensed under the GPL. Permission granted for display on the Abscissa Tech web site on March 9, 2000. The most recent PHP documentation is available at http://www.php.net/.