<HTML ><HEAD ><TITLE >WDDX functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK REL="HOME" TITLE="PHP Manual" HREF="manual.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="vm_deluser" HREF="function.vm-deluser.html"><LINK REL="NEXT" TITLE="wddx_serialize_value" HREF="function.wddx-serialize-value.html"></HEAD ><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.vm-deluser.html" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.wddx-serialize-value.html" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.wddx" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >LV. WDDX functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN27868" ></A ><P > These functions are intended for work with <A HREF="http://www.wddx.org/" TARGET="_top" >WDDX</A >.</P ><P > 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. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><P ><B >Example 1. Serializing a single value</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > 1 2 <?php 3 print wddx_serialize_value("PHP to WDDX packet example", "PHP packet"); 4 ?> 5 </PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></P ><P > This example will produce: <DIV CLASS="informalexample" ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > 1 2 <wddxPacket version='0.9'><header comment='PHP packet'/><data> 3 <string>PHP to WDDX packet example</string></data></wddxPacket> 4 </PRE ></TD ></TR ></TABLE ><P ></P ></DIV > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><P ><B >Example 2. Using incremental packets</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > 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 </PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></P ><P > This example will produce: <DIV CLASS="informalexample" ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="programlisting" > 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 </PRE ></TD ></TR ></TABLE ><P ></P ></DIV ></P ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.wddx-serialize-value.html" >wddx_serialize_value</A > — Serialize a single value into a WDDX packet</DT ><DT ><A HREF="function.wddx-serialize-vars.html" >wddx_serialize_vars</A > — Serialize variables into a WDDX packet</DT ><DT ><A HREF="function.wddx-packet-start.html" >wddx_packet_start</A > — Starts a new WDDX packet with structure inside it</DT ><DT ><A HREF="function.wddx-packet-end.html" >wddx_packet_end</A > — Ends a WDDX packet with the specified ID</DT ><DT ><A HREF="function.wddx-add-vars.html" >wddx_add_vars</A > — Ends a WDDX packet with the specified ID</DT ><DT ><A HREF="function.wddx-deserialize.html" >wddx_deserialize</A > — Deserializes a WDDX packet</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.vm-deluser.html" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="manual.html" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.wddx-serialize-value.html" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >vm_deluser</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >wddx_serialize_value</TD ></TR ></TABLE ></DIV ></BODY ></HTML >