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'> <string>a</string> <string>b</string> <string>c</string> <number>1</number> <number>2</number> <boolean>true</boolean> </array>
This is example using:
<wddxPacket version='1.0'>
<header />
<data>
<array length='4'>
<number>1</number>
<string>Wiwit Siswoutomo</string>
<string>PHPEveryday.com</string>
<boolean>1</boolean>
</array>
</data>
</wddxPacket>
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 advertisements blog comments powered by Disqus |

