PHP WDDX: Using Array Elements

Web Distributed Data Exchange Step By Step tutorial - Part 5: It is not like php array. In PHP array, we can have numeric or string indexes. At WDDW, array is only for numeric index. String based indexed array are handled with struct element.

if we want to write:

array(0=>'a', 1=>'b', 2=>'c', 3=>1, 4=>2, 5=>true)

We can use:

<array length='6'>

This is example using:

<wddxPacket version='1.0'>
  <header />
    <array length='4'>
	  <string>Wiwit Siswoutomo</string>

The important note: this is zero based arrays. Creating arrays that are not zero-based, such as array(2=>'c',3=>'d'), would result in a struct with named variables rather than array elements.

Series this article:
PHP WDDX: Introduction
PHP WDDX: Understanding Anatomy of WDDX
PHP WDDX: Understanding Data Elements
PHP WDDX: Understanding Simple Data Type
PHP WDDX: Using Array Elements
PHP WDDX: Struct Element
PHP WDDX: Recordset Element
PHP WDDX: Simple Serialization Using PHP function
PHP WDDX: Complex Serialization
PHP WDDX: Unserializing Data
PHP WDDX: Creating Web Service Server
PHP WDDX: Creating Web Service Client

Bookmark and Share Tag: wddx, distributed data, data type, elements, array Category: PHP Application Post : April 29th 2008 Read: 23,934


blog comments powered by Disqus