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