1--TEST--
2Test base_convert() - basic function tests base_convert()
3--FILE--
4<?php
5$frombase = array(2,8,10,16,36);
6$tobase = array(2,8,10,16,36);
7
8$values = array(10,
9                27,
10                39,
11                03,
12                0x5F,
13                "10",
14                "27",
15                "39",
16                "5F",
17                "3XYZ"
18                );
19
20for ($f= 0; $f < count($frombase); $f++) {
21    echo "\n...from base is ", $frombase[$f], "\n";
22    for ($t= 0; $t < count($tobase); $t++) {
23        echo "......to base is ", $tobase[$t], "\n";
24        for ($i =0; $i < count($values); $i++){
25            $res = base_convert($values[$i],$frombase[$f],$tobase[$t]);
26            echo ".........value= ", $values[$i], " res = ", $res, "\n";
27        }
28    }
29}
30?>
31--EXPECTF--
32...from base is 2
33......to base is 2
34.........value= 10 res = 10
35
36Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
37.........value= 27 res = 0
38
39Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
40.........value= 39 res = 0
41
42Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
43.........value= 3 res = 0
44
45Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
46.........value= 95 res = 0
47.........value= 10 res = 10
48
49Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
50.........value= 27 res = 0
51
52Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
53.........value= 39 res = 0
54
55Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
56.........value= 5F res = 0
57
58Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
59.........value= 3XYZ res = 0
60......to base is 8
61.........value= 10 res = 2
62
63Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
64.........value= 27 res = 0
65
66Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
67.........value= 39 res = 0
68
69Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
70.........value= 3 res = 0
71
72Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
73.........value= 95 res = 0
74.........value= 10 res = 2
75
76Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
77.........value= 27 res = 0
78
79Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
80.........value= 39 res = 0
81
82Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
83.........value= 5F res = 0
84
85Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
86.........value= 3XYZ res = 0
87......to base is 10
88.........value= 10 res = 2
89
90Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
91.........value= 27 res = 0
92
93Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
94.........value= 39 res = 0
95
96Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
97.........value= 3 res = 0
98
99Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
100.........value= 95 res = 0
101.........value= 10 res = 2
102
103Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
104.........value= 27 res = 0
105
106Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
107.........value= 39 res = 0
108
109Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
110.........value= 5F res = 0
111
112Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
113.........value= 3XYZ res = 0
114......to base is 16
115.........value= 10 res = 2
116
117Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
118.........value= 27 res = 0
119
120Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
121.........value= 39 res = 0
122
123Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
124.........value= 3 res = 0
125
126Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
127.........value= 95 res = 0
128.........value= 10 res = 2
129
130Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
131.........value= 27 res = 0
132
133Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
134.........value= 39 res = 0
135
136Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
137.........value= 5F res = 0
138
139Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
140.........value= 3XYZ res = 0
141......to base is 36
142.........value= 10 res = 2
143
144Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
145.........value= 27 res = 0
146
147Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
148.........value= 39 res = 0
149
150Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
151.........value= 3 res = 0
152
153Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
154.........value= 95 res = 0
155.........value= 10 res = 2
156
157Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
158.........value= 27 res = 0
159
160Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
161.........value= 39 res = 0
162
163Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
164.........value= 5F res = 0
165
166Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
167.........value= 3XYZ res = 0
168
169...from base is 8
170......to base is 2
171.........value= 10 res = 1000
172.........value= 27 res = 10111
173
174Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
175.........value= 39 res = 11
176.........value= 3 res = 11
177
178Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
179.........value= 95 res = 101
180.........value= 10 res = 1000
181.........value= 27 res = 10111
182
183Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
184.........value= 39 res = 11
185
186Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
187.........value= 5F res = 101
188
189Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
190.........value= 3XYZ res = 11
191......to base is 8
192.........value= 10 res = 10
193.........value= 27 res = 27
194
195Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
196.........value= 39 res = 3
197.........value= 3 res = 3
198
199Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
200.........value= 95 res = 5
201.........value= 10 res = 10
202.........value= 27 res = 27
203
204Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
205.........value= 39 res = 3
206
207Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
208.........value= 5F res = 5
209
210Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
211.........value= 3XYZ res = 3
212......to base is 10
213.........value= 10 res = 8
214.........value= 27 res = 23
215
216Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
217.........value= 39 res = 3
218.........value= 3 res = 3
219
220Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
221.........value= 95 res = 5
222.........value= 10 res = 8
223.........value= 27 res = 23
224
225Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
226.........value= 39 res = 3
227
228Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
229.........value= 5F res = 5
230
231Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
232.........value= 3XYZ res = 3
233......to base is 16
234.........value= 10 res = 8
235.........value= 27 res = 17
236
237Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
238.........value= 39 res = 3
239.........value= 3 res = 3
240
241Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
242.........value= 95 res = 5
243.........value= 10 res = 8
244.........value= 27 res = 17
245
246Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
247.........value= 39 res = 3
248
249Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
250.........value= 5F res = 5
251
252Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
253.........value= 3XYZ res = 3
254......to base is 36
255.........value= 10 res = 8
256.........value= 27 res = n
257
258Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
259.........value= 39 res = 3
260.........value= 3 res = 3
261
262Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
263.........value= 95 res = 5
264.........value= 10 res = 8
265.........value= 27 res = n
266
267Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
268.........value= 39 res = 3
269
270Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
271.........value= 5F res = 5
272
273Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
274.........value= 3XYZ res = 3
275
276...from base is 10
277......to base is 2
278.........value= 10 res = 1010
279.........value= 27 res = 11011
280.........value= 39 res = 100111
281.........value= 3 res = 11
282.........value= 95 res = 1011111
283.........value= 10 res = 1010
284.........value= 27 res = 11011
285.........value= 39 res = 100111
286
287Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
288.........value= 5F res = 101
289
290Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
291.........value= 3XYZ res = 11
292......to base is 8
293.........value= 10 res = 12
294.........value= 27 res = 33
295.........value= 39 res = 47
296.........value= 3 res = 3
297.........value= 95 res = 137
298.........value= 10 res = 12
299.........value= 27 res = 33
300.........value= 39 res = 47
301
302Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
303.........value= 5F res = 5
304
305Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
306.........value= 3XYZ res = 3
307......to base is 10
308.........value= 10 res = 10
309.........value= 27 res = 27
310.........value= 39 res = 39
311.........value= 3 res = 3
312.........value= 95 res = 95
313.........value= 10 res = 10
314.........value= 27 res = 27
315.........value= 39 res = 39
316
317Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
318.........value= 5F res = 5
319
320Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
321.........value= 3XYZ res = 3
322......to base is 16
323.........value= 10 res = a
324.........value= 27 res = 1b
325.........value= 39 res = 27
326.........value= 3 res = 3
327.........value= 95 res = 5f
328.........value= 10 res = a
329.........value= 27 res = 1b
330.........value= 39 res = 27
331
332Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
333.........value= 5F res = 5
334
335Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
336.........value= 3XYZ res = 3
337......to base is 36
338.........value= 10 res = a
339.........value= 27 res = r
340.........value= 39 res = 13
341.........value= 3 res = 3
342.........value= 95 res = 2n
343.........value= 10 res = a
344.........value= 27 res = r
345.........value= 39 res = 13
346
347Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
348.........value= 5F res = 5
349
350Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
351.........value= 3XYZ res = 3
352
353...from base is 16
354......to base is 2
355.........value= 10 res = 10000
356.........value= 27 res = 100111
357.........value= 39 res = 111001
358.........value= 3 res = 11
359.........value= 95 res = 10010101
360.........value= 10 res = 10000
361.........value= 27 res = 100111
362.........value= 39 res = 111001
363.........value= 5F res = 1011111
364
365Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
366.........value= 3XYZ res = 11
367......to base is 8
368.........value= 10 res = 20
369.........value= 27 res = 47
370.........value= 39 res = 71
371.........value= 3 res = 3
372.........value= 95 res = 225
373.........value= 10 res = 20
374.........value= 27 res = 47
375.........value= 39 res = 71
376.........value= 5F res = 137
377
378Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
379.........value= 3XYZ res = 3
380......to base is 10
381.........value= 10 res = 16
382.........value= 27 res = 39
383.........value= 39 res = 57
384.........value= 3 res = 3
385.........value= 95 res = 149
386.........value= 10 res = 16
387.........value= 27 res = 39
388.........value= 39 res = 57
389.........value= 5F res = 95
390
391Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
392.........value= 3XYZ res = 3
393......to base is 16
394.........value= 10 res = 10
395.........value= 27 res = 27
396.........value= 39 res = 39
397.........value= 3 res = 3
398.........value= 95 res = 95
399.........value= 10 res = 10
400.........value= 27 res = 27
401.........value= 39 res = 39
402.........value= 5F res = 5f
403
404Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
405.........value= 3XYZ res = 3
406......to base is 36
407.........value= 10 res = g
408.........value= 27 res = 13
409.........value= 39 res = 1l
410.........value= 3 res = 3
411.........value= 95 res = 45
412.........value= 10 res = g
413.........value= 27 res = 13
414.........value= 39 res = 1l
415.........value= 5F res = 2n
416
417Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
418.........value= 3XYZ res = 3
419
420...from base is 36
421......to base is 2
422.........value= 10 res = 100100
423.........value= 27 res = 1001111
424.........value= 39 res = 1110101
425.........value= 3 res = 11
426.........value= 95 res = 101001001
427.........value= 10 res = 100100
428.........value= 27 res = 1001111
429.........value= 39 res = 1110101
430.........value= 5F res = 11000011
431.........value= 3XYZ res = 101100111010111011
432......to base is 8
433.........value= 10 res = 44
434.........value= 27 res = 117
435.........value= 39 res = 165
436.........value= 3 res = 3
437.........value= 95 res = 511
438.........value= 10 res = 44
439.........value= 27 res = 117
440.........value= 39 res = 165
441.........value= 5F res = 303
442.........value= 3XYZ res = 547273
443......to base is 10
444.........value= 10 res = 36
445.........value= 27 res = 79
446.........value= 39 res = 117
447.........value= 3 res = 3
448.........value= 95 res = 329
449.........value= 10 res = 36
450.........value= 27 res = 79
451.........value= 39 res = 117
452.........value= 5F res = 195
453.........value= 3XYZ res = 183995
454......to base is 16
455.........value= 10 res = 24
456.........value= 27 res = 4f
457.........value= 39 res = 75
458.........value= 3 res = 3
459.........value= 95 res = 149
460.........value= 10 res = 24
461.........value= 27 res = 4f
462.........value= 39 res = 75
463.........value= 5F res = c3
464.........value= 3XYZ res = 2cebb
465......to base is 36
466.........value= 10 res = 10
467.........value= 27 res = 27
468.........value= 39 res = 39
469.........value= 3 res = 3
470.........value= 95 res = 95
471.........value= 10 res = 10
472.........value= 27 res = 27
473.........value= 39 res = 39
474.........value= 5F res = 5f
475.........value= 3XYZ res = 3xyz
476