1--TEST-- 2xmlrpc_encode() Simple test encode array 3--SKIPIF-- 4<?php if (!extension_loaded("xmlrpc")) print "skip"; ?> 5--FILE-- 6<?php 7 8$params = array( 9 "one" => "red", 10 "two" => "blue", 11 "three" => "green" 12); 13 14$response = xmlrpc_encode($params); 15echo $response; 16 17$params = array( 18 "red", 19 "blue", 20 "green" 21); 22 23$response = xmlrpc_encode($params); 24echo $response; 25 26$params = array( 27 0 => "red", 28 1 => "blue", 29 3 => "green" 30); 31 32$response = xmlrpc_encode($params); 33echo $response; 34 35--EXPECT-- 36<?xml version="1.0" encoding="utf-8"?> 37<params> 38<param> 39 <value> 40 <struct> 41 <member> 42 <name>one</name> 43 <value> 44 <string>red</string> 45 </value> 46 </member> 47 <member> 48 <name>two</name> 49 <value> 50 <string>blue</string> 51 </value> 52 </member> 53 <member> 54 <name>three</name> 55 <value> 56 <string>green</string> 57 </value> 58 </member> 59 </struct> 60 </value> 61</param> 62</params> 63<?xml version="1.0" encoding="utf-8"?> 64<params> 65<param> 66 <value> 67 <array> 68 <data> 69 <value> 70 <string>red</string> 71 </value> 72 <value> 73 <string>blue</string> 74 </value> 75 <value> 76 <string>green</string> 77 </value> 78 </data> 79 </array> 80 </value> 81</param> 82</params> 83<?xml version="1.0" encoding="utf-8"?> 84<params> 85<param> 86 <value> 87 <struct> 88 <member> 89 <name>0</name> 90 <value> 91 <string>red</string> 92 </value> 93 </member> 94 <member> 95 <name>1</name> 96 <value> 97 <string>blue</string> 98 </value> 99 </member> 100 <member> 101 <name>3</name> 102 <value> 103 <string>green</string> 104 </value> 105 </member> 106 </struct> 107 </value> 108</param> 109</params>