1--TEST--
2Test ^ operator : various numbers as strings
3--FILE--
4<?php
5
6$strVals = array(
7   "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
8   "a5.9"
9);
10
11error_reporting(E_ERROR);
12
13foreach ($strVals as $strVal) {
14   foreach($strVals as $otherVal) {
15	   echo "--- testing: '$strVal' ^ '$otherVal' ---\n";
16      var_dump(bin2hex($strVal^$otherVal));
17   }
18}
19
20
21?>
22===DONE===
23--EXPECT--
24--- testing: '0' ^ '0' ---
25string(2) "00"
26--- testing: '0' ^ '65' ---
27string(2) "06"
28--- testing: '0' ^ '-44' ---
29string(2) "1d"
30--- testing: '0' ^ '1.2' ---
31string(2) "01"
32--- testing: '0' ^ '-7.7' ---
33string(2) "1d"
34--- testing: '0' ^ 'abc' ---
35string(2) "51"
36--- testing: '0' ^ '123abc' ---
37string(2) "01"
38--- testing: '0' ^ '123e5' ---
39string(2) "01"
40--- testing: '0' ^ '123e5xyz' ---
41string(2) "01"
42--- testing: '0' ^ ' 123abc' ---
43string(2) "10"
44--- testing: '0' ^ '123 abc' ---
45string(2) "01"
46--- testing: '0' ^ '123abc ' ---
47string(2) "01"
48--- testing: '0' ^ '3.4a' ---
49string(2) "03"
50--- testing: '0' ^ 'a5.9' ---
51string(2) "51"
52--- testing: '65' ^ '0' ---
53string(2) "06"
54--- testing: '65' ^ '65' ---
55string(4) "0000"
56--- testing: '65' ^ '-44' ---
57string(4) "1b01"
58--- testing: '65' ^ '1.2' ---
59string(4) "071b"
60--- testing: '65' ^ '-7.7' ---
61string(4) "1b02"
62--- testing: '65' ^ 'abc' ---
63string(4) "5757"
64--- testing: '65' ^ '123abc' ---
65string(4) "0707"
66--- testing: '65' ^ '123e5' ---
67string(4) "0707"
68--- testing: '65' ^ '123e5xyz' ---
69string(4) "0707"
70--- testing: '65' ^ ' 123abc' ---
71string(4) "1604"
72--- testing: '65' ^ '123 abc' ---
73string(4) "0707"
74--- testing: '65' ^ '123abc ' ---
75string(4) "0707"
76--- testing: '65' ^ '3.4a' ---
77string(4) "051b"
78--- testing: '65' ^ 'a5.9' ---
79string(4) "5700"
80--- testing: '-44' ^ '0' ---
81string(2) "1d"
82--- testing: '-44' ^ '65' ---
83string(4) "1b01"
84--- testing: '-44' ^ '-44' ---
85string(6) "000000"
86--- testing: '-44' ^ '1.2' ---
87string(6) "1c1a06"
88--- testing: '-44' ^ '-7.7' ---
89string(6) "00031a"
90--- testing: '-44' ^ 'abc' ---
91string(6) "4c5657"
92--- testing: '-44' ^ '123abc' ---
93string(6) "1c0607"
94--- testing: '-44' ^ '123e5' ---
95string(6) "1c0607"
96--- testing: '-44' ^ '123e5xyz' ---
97string(6) "1c0607"
98--- testing: '-44' ^ ' 123abc' ---
99string(6) "0d0506"
100--- testing: '-44' ^ '123 abc' ---
101string(6) "1c0607"
102--- testing: '-44' ^ '123abc ' ---
103string(6) "1c0607"
104--- testing: '-44' ^ '3.4a' ---
105string(6) "1e1a00"
106--- testing: '-44' ^ 'a5.9' ---
107string(6) "4c011a"
108--- testing: '1.2' ^ '0' ---
109string(2) "01"
110--- testing: '1.2' ^ '65' ---
111string(4) "071b"
112--- testing: '1.2' ^ '-44' ---
113string(6) "1c1a06"
114--- testing: '1.2' ^ '1.2' ---
115string(6) "000000"
116--- testing: '1.2' ^ '-7.7' ---
117string(6) "1c191c"
118--- testing: '1.2' ^ 'abc' ---
119string(6) "504c51"
120--- testing: '1.2' ^ '123abc' ---
121string(6) "001c01"
122--- testing: '1.2' ^ '123e5' ---
123string(6) "001c01"
124--- testing: '1.2' ^ '123e5xyz' ---
125string(6) "001c01"
126--- testing: '1.2' ^ ' 123abc' ---
127string(6) "111f00"
128--- testing: '1.2' ^ '123 abc' ---
129string(6) "001c01"
130--- testing: '1.2' ^ '123abc ' ---
131string(6) "001c01"
132--- testing: '1.2' ^ '3.4a' ---
133string(6) "020006"
134--- testing: '1.2' ^ 'a5.9' ---
135string(6) "501b1c"
136--- testing: '-7.7' ^ '0' ---
137string(2) "1d"
138--- testing: '-7.7' ^ '65' ---
139string(4) "1b02"
140--- testing: '-7.7' ^ '-44' ---
141string(6) "00031a"
142--- testing: '-7.7' ^ '1.2' ---
143string(6) "1c191c"
144--- testing: '-7.7' ^ '-7.7' ---
145string(8) "00000000"
146--- testing: '-7.7' ^ 'abc' ---
147string(6) "4c554d"
148--- testing: '-7.7' ^ '123abc' ---
149string(8) "1c051d56"
150--- testing: '-7.7' ^ '123e5' ---
151string(8) "1c051d52"
152--- testing: '-7.7' ^ '123e5xyz' ---
153string(8) "1c051d52"
154--- testing: '-7.7' ^ ' 123abc' ---
155string(8) "0d061c04"
156--- testing: '-7.7' ^ '123 abc' ---
157string(8) "1c051d17"
158--- testing: '-7.7' ^ '123abc ' ---
159string(8) "1c051d56"
160--- testing: '-7.7' ^ '3.4a' ---
161string(8) "1e191a56"
162--- testing: '-7.7' ^ 'a5.9' ---
163string(8) "4c02000e"
164--- testing: 'abc' ^ '0' ---
165string(2) "51"
166--- testing: 'abc' ^ '65' ---
167string(4) "5757"
168--- testing: 'abc' ^ '-44' ---
169string(6) "4c5657"
170--- testing: 'abc' ^ '1.2' ---
171string(6) "504c51"
172--- testing: 'abc' ^ '-7.7' ---
173string(6) "4c554d"
174--- testing: 'abc' ^ 'abc' ---
175string(6) "000000"
176--- testing: 'abc' ^ '123abc' ---
177string(6) "505050"
178--- testing: 'abc' ^ '123e5' ---
179string(6) "505050"
180--- testing: 'abc' ^ '123e5xyz' ---
181string(6) "505050"
182--- testing: 'abc' ^ ' 123abc' ---
183string(6) "415351"
184--- testing: 'abc' ^ '123 abc' ---
185string(6) "505050"
186--- testing: 'abc' ^ '123abc ' ---
187string(6) "505050"
188--- testing: 'abc' ^ '3.4a' ---
189string(6) "524c57"
190--- testing: 'abc' ^ 'a5.9' ---
191string(6) "00574d"
192--- testing: '123abc' ^ '0' ---
193string(2) "01"
194--- testing: '123abc' ^ '65' ---
195string(4) "0707"
196--- testing: '123abc' ^ '-44' ---
197string(6) "1c0607"
198--- testing: '123abc' ^ '1.2' ---
199string(6) "001c01"
200--- testing: '123abc' ^ '-7.7' ---
201string(8) "1c051d56"
202--- testing: '123abc' ^ 'abc' ---
203string(6) "505050"
204--- testing: '123abc' ^ '123abc' ---
205string(12) "000000000000"
206--- testing: '123abc' ^ '123e5' ---
207string(10) "0000000457"
208--- testing: '123abc' ^ '123e5xyz' ---
209string(12) "00000004571b"
210--- testing: '123abc' ^ ' 123abc' ---
211string(12) "110301520301"
212--- testing: '123abc' ^ '123 abc' ---
213string(12) "000000410301"
214--- testing: '123abc' ^ '123abc ' ---
215string(12) "000000000000"
216--- testing: '123abc' ^ '3.4a' ---
217string(8) "021c0700"
218--- testing: '123abc' ^ 'a5.9' ---
219string(8) "50071d58"
220--- testing: '123e5' ^ '0' ---
221string(2) "01"
222--- testing: '123e5' ^ '65' ---
223string(4) "0707"
224--- testing: '123e5' ^ '-44' ---
225string(6) "1c0607"
226--- testing: '123e5' ^ '1.2' ---
227string(6) "001c01"
228--- testing: '123e5' ^ '-7.7' ---
229string(8) "1c051d52"
230--- testing: '123e5' ^ 'abc' ---
231string(6) "505050"
232--- testing: '123e5' ^ '123abc' ---
233string(10) "0000000457"
234--- testing: '123e5' ^ '123e5' ---
235string(10) "0000000000"
236--- testing: '123e5' ^ '123e5xyz' ---
237string(10) "0000000000"
238--- testing: '123e5' ^ ' 123abc' ---
239string(10) "1103015654"
240--- testing: '123e5' ^ '123 abc' ---
241string(10) "0000004554"
242--- testing: '123e5' ^ '123abc ' ---
243string(10) "0000000457"
244--- testing: '123e5' ^ '3.4a' ---
245string(8) "021c0704"
246--- testing: '123e5' ^ 'a5.9' ---
247string(8) "50071d5c"
248--- testing: '123e5xyz' ^ '0' ---
249string(2) "01"
250--- testing: '123e5xyz' ^ '65' ---
251string(4) "0707"
252--- testing: '123e5xyz' ^ '-44' ---
253string(6) "1c0607"
254--- testing: '123e5xyz' ^ '1.2' ---
255string(6) "001c01"
256--- testing: '123e5xyz' ^ '-7.7' ---
257string(8) "1c051d52"
258--- testing: '123e5xyz' ^ 'abc' ---
259string(6) "505050"
260--- testing: '123e5xyz' ^ '123abc' ---
261string(12) "00000004571b"
262--- testing: '123e5xyz' ^ '123e5' ---
263string(10) "0000000000"
264--- testing: '123e5xyz' ^ '123e5xyz' ---
265string(16) "0000000000000000"
266--- testing: '123e5xyz' ^ ' 123abc' ---
267string(14) "11030156541a1a"
268--- testing: '123e5xyz' ^ '123 abc' ---
269string(14) "00000045541a1a"
270--- testing: '123e5xyz' ^ '123abc ' ---
271string(14) "00000004571b59"
272--- testing: '123e5xyz' ^ '3.4a' ---
273string(8) "021c0704"
274--- testing: '123e5xyz' ^ 'a5.9' ---
275string(8) "50071d5c"
276--- testing: ' 123abc' ^ '0' ---
277string(2) "10"
278--- testing: ' 123abc' ^ '65' ---
279string(4) "1604"
280--- testing: ' 123abc' ^ '-44' ---
281string(6) "0d0506"
282--- testing: ' 123abc' ^ '1.2' ---
283string(6) "111f00"
284--- testing: ' 123abc' ^ '-7.7' ---
285string(8) "0d061c04"
286--- testing: ' 123abc' ^ 'abc' ---
287string(6) "415351"
288--- testing: ' 123abc' ^ '123abc' ---
289string(12) "110301520301"
290--- testing: ' 123abc' ^ '123e5' ---
291string(10) "1103015654"
292--- testing: ' 123abc' ^ '123e5xyz' ---
293string(14) "11030156541a1a"
294--- testing: ' 123abc' ^ ' 123abc' ---
295string(14) "00000000000000"
296--- testing: ' 123abc' ^ '123 abc' ---
297string(14) "11030113000000"
298--- testing: ' 123abc' ^ '123abc ' ---
299string(14) "11030152030143"
300--- testing: ' 123abc' ^ '3.4a' ---
301string(8) "131f0652"
302--- testing: ' 123abc' ^ 'a5.9' ---
303string(8) "41041c0a"
304--- testing: '123 abc' ^ '0' ---
305string(2) "01"
306--- testing: '123 abc' ^ '65' ---
307string(4) "0707"
308--- testing: '123 abc' ^ '-44' ---
309string(6) "1c0607"
310--- testing: '123 abc' ^ '1.2' ---
311string(6) "001c01"
312--- testing: '123 abc' ^ '-7.7' ---
313string(8) "1c051d17"
314--- testing: '123 abc' ^ 'abc' ---
315string(6) "505050"
316--- testing: '123 abc' ^ '123abc' ---
317string(12) "000000410301"
318--- testing: '123 abc' ^ '123e5' ---
319string(10) "0000004554"
320--- testing: '123 abc' ^ '123e5xyz' ---
321string(14) "00000045541a1a"
322--- testing: '123 abc' ^ ' 123abc' ---
323string(14) "11030113000000"
324--- testing: '123 abc' ^ '123 abc' ---
325string(14) "00000000000000"
326--- testing: '123 abc' ^ '123abc ' ---
327string(14) "00000041030143"
328--- testing: '123 abc' ^ '3.4a' ---
329string(8) "021c0741"
330--- testing: '123 abc' ^ 'a5.9' ---
331string(8) "50071d19"
332--- testing: '123abc ' ^ '0' ---
333string(2) "01"
334--- testing: '123abc ' ^ '65' ---
335string(4) "0707"
336--- testing: '123abc ' ^ '-44' ---
337string(6) "1c0607"
338--- testing: '123abc ' ^ '1.2' ---
339string(6) "001c01"
340--- testing: '123abc ' ^ '-7.7' ---
341string(8) "1c051d56"
342--- testing: '123abc ' ^ 'abc' ---
343string(6) "505050"
344--- testing: '123abc ' ^ '123abc' ---
345string(12) "000000000000"
346--- testing: '123abc ' ^ '123e5' ---
347string(10) "0000000457"
348--- testing: '123abc ' ^ '123e5xyz' ---
349string(14) "00000004571b59"
350--- testing: '123abc ' ^ ' 123abc' ---
351string(14) "11030152030143"
352--- testing: '123abc ' ^ '123 abc' ---
353string(14) "00000041030143"
354--- testing: '123abc ' ^ '123abc ' ---
355string(14) "00000000000000"
356--- testing: '123abc ' ^ '3.4a' ---
357string(8) "021c0700"
358--- testing: '123abc ' ^ 'a5.9' ---
359string(8) "50071d58"
360--- testing: '3.4a' ^ '0' ---
361string(2) "03"
362--- testing: '3.4a' ^ '65' ---
363string(4) "051b"
364--- testing: '3.4a' ^ '-44' ---
365string(6) "1e1a00"
366--- testing: '3.4a' ^ '1.2' ---
367string(6) "020006"
368--- testing: '3.4a' ^ '-7.7' ---
369string(8) "1e191a56"
370--- testing: '3.4a' ^ 'abc' ---
371string(6) "524c57"
372--- testing: '3.4a' ^ '123abc' ---
373string(8) "021c0700"
374--- testing: '3.4a' ^ '123e5' ---
375string(8) "021c0704"
376--- testing: '3.4a' ^ '123e5xyz' ---
377string(8) "021c0704"
378--- testing: '3.4a' ^ ' 123abc' ---
379string(8) "131f0652"
380--- testing: '3.4a' ^ '123 abc' ---
381string(8) "021c0741"
382--- testing: '3.4a' ^ '123abc ' ---
383string(8) "021c0700"
384--- testing: '3.4a' ^ '3.4a' ---
385string(8) "00000000"
386--- testing: '3.4a' ^ 'a5.9' ---
387string(8) "521b1a58"
388--- testing: 'a5.9' ^ '0' ---
389string(2) "51"
390--- testing: 'a5.9' ^ '65' ---
391string(4) "5700"
392--- testing: 'a5.9' ^ '-44' ---
393string(6) "4c011a"
394--- testing: 'a5.9' ^ '1.2' ---
395string(6) "501b1c"
396--- testing: 'a5.9' ^ '-7.7' ---
397string(8) "4c02000e"
398--- testing: 'a5.9' ^ 'abc' ---
399string(6) "00574d"
400--- testing: 'a5.9' ^ '123abc' ---
401string(8) "50071d58"
402--- testing: 'a5.9' ^ '123e5' ---
403string(8) "50071d5c"
404--- testing: 'a5.9' ^ '123e5xyz' ---
405string(8) "50071d5c"
406--- testing: 'a5.9' ^ ' 123abc' ---
407string(8) "41041c0a"
408--- testing: 'a5.9' ^ '123 abc' ---
409string(8) "50071d19"
410--- testing: 'a5.9' ^ '123abc ' ---
411string(8) "50071d58"
412--- testing: 'a5.9' ^ '3.4a' ---
413string(8) "521b1a58"
414--- testing: 'a5.9' ^ 'a5.9' ---
415string(8) "00000000"
416===DONE===
417