xref: /PHP-7.1/ext/xmlrpc/tests/003.phpt (revision 113213f0)
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--EXPECT--
35<?xml version="1.0" encoding="utf-8"?>
36<params>
37<param>
38 <value>
39  <struct>
40   <member>
41    <name>one</name>
42    <value>
43     <string>red</string>
44    </value>
45   </member>
46   <member>
47    <name>two</name>
48    <value>
49     <string>blue</string>
50    </value>
51   </member>
52   <member>
53    <name>three</name>
54    <value>
55     <string>green</string>
56    </value>
57   </member>
58  </struct>
59 </value>
60</param>
61</params>
62<?xml version="1.0" encoding="utf-8"?>
63<params>
64<param>
65 <value>
66  <array>
67   <data>
68    <value>
69     <string>red</string>
70    </value>
71    <value>
72     <string>blue</string>
73    </value>
74    <value>
75     <string>green</string>
76    </value>
77   </data>
78  </array>
79 </value>
80</param>
81</params>
82<?xml version="1.0" encoding="utf-8"?>
83<params>
84<param>
85 <value>
86  <struct>
87   <member>
88    <name>0</name>
89    <value>
90     <string>red</string>
91    </value>
92   </member>
93   <member>
94    <name>1</name>
95    <value>
96     <string>blue</string>
97    </value>
98   </member>
99   <member>
100    <name>3</name>
101    <value>
102     <string>green</string>
103    </value>
104   </member>
105  </struct>
106 </value>
107</param>
108</params>
109