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) "30"
25--- testing: '0' & '65' ---
26string(2) "30"
27--- testing: '0' & '-44' ---
28string(2) "20"
29--- testing: '0' & '1.2' ---
30string(2) "30"
31--- testing: '0' & '-7.7' ---
32string(2) "20"
33--- testing: '0' & 'abc' ---
34string(2) "20"
35--- testing: '0' & '123abc' ---
36string(2) "30"
37--- testing: '0' & '123e5' ---
38string(2) "30"
39--- testing: '0' & '123e5xyz' ---
40string(2) "30"
41--- testing: '0' & ' 123abc' ---
42string(2) "20"
43--- testing: '0' & '123 abc' ---
44string(2) "30"
45--- testing: '0' & '123abc ' ---
46string(2) "30"
47--- testing: '0' & '3.4a' ---
48string(2) "30"
49--- testing: '0' & 'a5.9' ---
50string(2) "20"
51--- testing: '65' & '0' ---
52string(2) "30"
53--- testing: '65' & '65' ---
54string(4) "3635"
55--- testing: '65' & '-44' ---
56string(4) "2434"
57--- testing: '65' & '1.2' ---
58string(4) "3024"
59--- testing: '65' & '-7.7' ---
60string(4) "2435"
61--- testing: '65' & 'abc' ---
62string(4) "2020"
63--- testing: '65' & '123abc' ---
64string(4) "3030"
65--- testing: '65' & '123e5' ---
66string(4) "3030"
67--- testing: '65' & '123e5xyz' ---
68string(4) "3030"
69--- testing: '65' & ' 123abc' ---
70string(4) "2031"
71--- testing: '65' & '123 abc' ---
72string(4) "3030"
73--- testing: '65' & '123abc ' ---
74string(4) "3030"
75--- testing: '65' & '3.4a' ---
76string(4) "3224"
77--- testing: '65' & 'a5.9' ---
78string(4) "2035"
79--- testing: '-44' & '0' ---
80string(2) "20"
81--- testing: '-44' & '65' ---
82string(4) "2434"
83--- testing: '-44' & '-44' ---
84string(6) "2d3434"
85--- testing: '-44' & '1.2' ---
86string(6) "212430"
87--- testing: '-44' & '-7.7' ---
88string(6) "2d3424"
89--- testing: '-44' & 'abc' ---
90string(6) "212020"
91--- testing: '-44' & '123abc' ---
92string(6) "213030"
93--- testing: '-44' & '123e5' ---
94string(6) "213030"
95--- testing: '-44' & '123e5xyz' ---
96string(6) "213030"
97--- testing: '-44' & ' 123abc' ---
98string(6) "203030"
99--- testing: '-44' & '123 abc' ---
100string(6) "213030"
101--- testing: '-44' & '123abc ' ---
102string(6) "213030"
103--- testing: '-44' & '3.4a' ---
104string(6) "212434"
105--- testing: '-44' & 'a5.9' ---
106string(6) "213424"
107--- testing: '1.2' & '0' ---
108string(2) "30"
109--- testing: '1.2' & '65' ---
110string(4) "3024"
111--- testing: '1.2' & '-44' ---
112string(6) "212430"
113--- testing: '1.2' & '1.2' ---
114string(6) "312e32"
115--- testing: '1.2' & '-7.7' ---
116string(6) "212622"
117--- testing: '1.2' & 'abc' ---
118string(6) "212222"
119--- testing: '1.2' & '123abc' ---
120string(6) "312232"
121--- testing: '1.2' & '123e5' ---
122string(6) "312232"
123--- testing: '1.2' & '123e5xyz' ---
124string(6) "312232"
125--- testing: '1.2' & ' 123abc' ---
126string(6) "202032"
127--- testing: '1.2' & '123 abc' ---
128string(6) "312232"
129--- testing: '1.2' & '123abc ' ---
130string(6) "312232"
131--- testing: '1.2' & '3.4a' ---
132string(6) "312e30"
133--- testing: '1.2' & 'a5.9' ---
134string(6) "212422"
135--- testing: '-7.7' & '0' ---
136string(2) "20"
137--- testing: '-7.7' & '65' ---
138string(4) "2435"
139--- testing: '-7.7' & '-44' ---
140string(6) "2d3424"
141--- testing: '-7.7' & '1.2' ---
142string(6) "212622"
143--- testing: '-7.7' & '-7.7' ---
144string(8) "2d372e37"
145--- testing: '-7.7' & 'abc' ---
146string(6) "212222"
147--- testing: '-7.7' & '123abc' ---
148string(8) "21322221"
149--- testing: '-7.7' & '123e5' ---
150string(8) "21322225"
151--- testing: '-7.7' & '123e5xyz' ---
152string(8) "21322225"
153--- testing: '-7.7' & ' 123abc' ---
154string(8) "20312233"
155--- testing: '-7.7' & '123 abc' ---
156string(8) "21322220"
157--- testing: '-7.7' & '123abc ' ---
158string(8) "21322221"
159--- testing: '-7.7' & '3.4a' ---
160string(8) "21262421"
161--- testing: '-7.7' & 'a5.9' ---
162string(8) "21352e31"
163--- testing: 'abc' & '0' ---
164string(2) "20"
165--- testing: 'abc' & '65' ---
166string(4) "2020"
167--- testing: 'abc' & '-44' ---
168string(6) "212020"
169--- testing: 'abc' & '1.2' ---
170string(6) "212222"
171--- testing: 'abc' & '-7.7' ---
172string(6) "212222"
173--- testing: 'abc' & 'abc' ---
174string(6) "616263"
175--- testing: 'abc' & '123abc' ---
176string(6) "212223"
177--- testing: 'abc' & '123e5' ---
178string(6) "212223"
179--- testing: 'abc' & '123e5xyz' ---
180string(6) "212223"
181--- testing: 'abc' & ' 123abc' ---
182string(6) "202022"
183--- testing: 'abc' & '123 abc' ---
184string(6) "212223"
185--- testing: 'abc' & '123abc ' ---
186string(6) "212223"
187--- testing: 'abc' & '3.4a' ---
188string(6) "212220"
189--- testing: 'abc' & 'a5.9' ---
190string(6) "612022"
191--- testing: '123abc' & '0' ---
192string(2) "30"
193--- testing: '123abc' & '65' ---
194string(4) "3030"
195--- testing: '123abc' & '-44' ---
196string(6) "213030"
197--- testing: '123abc' & '1.2' ---
198string(6) "312232"
199--- testing: '123abc' & '-7.7' ---
200string(8) "21322221"
201--- testing: '123abc' & 'abc' ---
202string(6) "212223"
203--- testing: '123abc' & '123abc' ---
204string(12) "313233616263"
205--- testing: '123abc' & '123e5' ---
206string(10) "3132336120"
207--- testing: '123abc' & '123e5xyz' ---
208string(12) "313233612060"
209--- testing: '123abc' & ' 123abc' ---
210string(12) "203032216062"
211--- testing: '123abc' & '123 abc' ---
212string(12) "313233206062"
213--- testing: '123abc' & '123abc ' ---
214string(12) "313233616263"
215--- testing: '123abc' & '3.4a' ---
216string(8) "31223061"
217--- testing: '123abc' & 'a5.9' ---
218string(8) "21302221"
219--- testing: '123e5' & '0' ---
220string(2) "30"
221--- testing: '123e5' & '65' ---
222string(4) "3030"
223--- testing: '123e5' & '-44' ---
224string(6) "213030"
225--- testing: '123e5' & '1.2' ---
226string(6) "312232"
227--- testing: '123e5' & '-7.7' ---
228string(8) "21322225"
229--- testing: '123e5' & 'abc' ---
230string(6) "212223"
231--- testing: '123e5' & '123abc' ---
232string(10) "3132336120"
233--- testing: '123e5' & '123e5' ---
234string(10) "3132336535"
235--- testing: '123e5' & '123e5xyz' ---
236string(10) "3132336535"
237--- testing: '123e5' & ' 123abc' ---
238string(10) "2030322121"
239--- testing: '123e5' & '123 abc' ---
240string(10) "3132332021"
241--- testing: '123e5' & '123abc ' ---
242string(10) "3132336120"
243--- testing: '123e5' & '3.4a' ---
244string(8) "31223061"
245--- testing: '123e5' & 'a5.9' ---
246string(8) "21302221"
247--- testing: '123e5xyz' & '0' ---
248string(2) "30"
249--- testing: '123e5xyz' & '65' ---
250string(4) "3030"
251--- testing: '123e5xyz' & '-44' ---
252string(6) "213030"
253--- testing: '123e5xyz' & '1.2' ---
254string(6) "312232"
255--- testing: '123e5xyz' & '-7.7' ---
256string(8) "21322225"
257--- testing: '123e5xyz' & 'abc' ---
258string(6) "212223"
259--- testing: '123e5xyz' & '123abc' ---
260string(12) "313233612060"
261--- testing: '123e5xyz' & '123e5' ---
262string(10) "3132336535"
263--- testing: '123e5xyz' & '123e5xyz' ---
264string(16) "313233653578797a"
265--- testing: '123e5xyz' & ' 123abc' ---
266string(14) "20303221216061"
267--- testing: '123e5xyz' & '123 abc' ---
268string(14) "31323320216061"
269--- testing: '123e5xyz' & '123abc ' ---
270string(14) "31323361206020"
271--- testing: '123e5xyz' & '3.4a' ---
272string(8) "31223061"
273--- testing: '123e5xyz' & 'a5.9' ---
274string(8) "21302221"
275--- testing: ' 123abc' & '0' ---
276string(2) "20"
277--- testing: ' 123abc' & '65' ---
278string(4) "2031"
279--- testing: ' 123abc' & '-44' ---
280string(6) "203030"
281--- testing: ' 123abc' & '1.2' ---
282string(6) "202032"
283--- testing: ' 123abc' & '-7.7' ---
284string(8) "20312233"
285--- testing: ' 123abc' & 'abc' ---
286string(6) "202022"
287--- testing: ' 123abc' & '123abc' ---
288string(12) "203032216062"
289--- testing: ' 123abc' & '123e5' ---
290string(10) "2030322121"
291--- testing: ' 123abc' & '123e5xyz' ---
292string(14) "20303221216061"
293--- testing: ' 123abc' & ' 123abc' ---
294string(14) "20313233616263"
295--- testing: ' 123abc' & '123 abc' ---
296string(14) "20303220616263"
297--- testing: ' 123abc' & '123abc ' ---
298string(14) "20303221606220"
299--- testing: ' 123abc' & '3.4a' ---
300string(8) "20203021"
301--- testing: ' 123abc' & 'a5.9' ---
302string(8) "20312231"
303--- testing: '123 abc' & '0' ---
304string(2) "30"
305--- testing: '123 abc' & '65' ---
306string(4) "3030"
307--- testing: '123 abc' & '-44' ---
308string(6) "213030"
309--- testing: '123 abc' & '1.2' ---
310string(6) "312232"
311--- testing: '123 abc' & '-7.7' ---
312string(8) "21322220"
313--- testing: '123 abc' & 'abc' ---
314string(6) "212223"
315--- testing: '123 abc' & '123abc' ---
316string(12) "313233206062"
317--- testing: '123 abc' & '123e5' ---
318string(10) "3132332021"
319--- testing: '123 abc' & '123e5xyz' ---
320string(14) "31323320216061"
321--- testing: '123 abc' & ' 123abc' ---
322string(14) "20303220616263"
323--- testing: '123 abc' & '123 abc' ---
324string(14) "31323320616263"
325--- testing: '123 abc' & '123abc ' ---
326string(14) "31323320606220"
327--- testing: '123 abc' & '3.4a' ---
328string(8) "31223020"
329--- testing: '123 abc' & 'a5.9' ---
330string(8) "21302220"
331--- testing: '123abc ' & '0' ---
332string(2) "30"
333--- testing: '123abc ' & '65' ---
334string(4) "3030"
335--- testing: '123abc ' & '-44' ---
336string(6) "213030"
337--- testing: '123abc ' & '1.2' ---
338string(6) "312232"
339--- testing: '123abc ' & '-7.7' ---
340string(8) "21322221"
341--- testing: '123abc ' & 'abc' ---
342string(6) "212223"
343--- testing: '123abc ' & '123abc' ---
344string(12) "313233616263"
345--- testing: '123abc ' & '123e5' ---
346string(10) "3132336120"
347--- testing: '123abc ' & '123e5xyz' ---
348string(14) "31323361206020"
349--- testing: '123abc ' & ' 123abc' ---
350string(14) "20303221606220"
351--- testing: '123abc ' & '123 abc' ---
352string(14) "31323320606220"
353--- testing: '123abc ' & '123abc ' ---
354string(14) "31323361626320"
355--- testing: '123abc ' & '3.4a' ---
356string(8) "31223061"
357--- testing: '123abc ' & 'a5.9' ---
358string(8) "21302221"
359--- testing: '3.4a' & '0' ---
360string(2) "30"
361--- testing: '3.4a' & '65' ---
362string(4) "3224"
363--- testing: '3.4a' & '-44' ---
364string(6) "212434"
365--- testing: '3.4a' & '1.2' ---
366string(6) "312e30"
367--- testing: '3.4a' & '-7.7' ---
368string(8) "21262421"
369--- testing: '3.4a' & 'abc' ---
370string(6) "212220"
371--- testing: '3.4a' & '123abc' ---
372string(8) "31223061"
373--- testing: '3.4a' & '123e5' ---
374string(8) "31223061"
375--- testing: '3.4a' & '123e5xyz' ---
376string(8) "31223061"
377--- testing: '3.4a' & ' 123abc' ---
378string(8) "20203021"
379--- testing: '3.4a' & '123 abc' ---
380string(8) "31223020"
381--- testing: '3.4a' & '123abc ' ---
382string(8) "31223061"
383--- testing: '3.4a' & '3.4a' ---
384string(8) "332e3461"
385--- testing: '3.4a' & 'a5.9' ---
386string(8) "21242421"
387--- testing: 'a5.9' & '0' ---
388string(2) "20"
389--- testing: 'a5.9' & '65' ---
390string(4) "2035"
391--- testing: 'a5.9' & '-44' ---
392string(6) "213424"
393--- testing: 'a5.9' & '1.2' ---
394string(6) "212422"
395--- testing: 'a5.9' & '-7.7' ---
396string(8) "21352e31"
397--- testing: 'a5.9' & 'abc' ---
398string(6) "612022"
399--- testing: 'a5.9' & '123abc' ---
400string(8) "21302221"
401--- testing: 'a5.9' & '123e5' ---
402string(8) "21302221"
403--- testing: 'a5.9' & '123e5xyz' ---
404string(8) "21302221"
405--- testing: 'a5.9' & ' 123abc' ---
406string(8) "20312231"
407--- testing: 'a5.9' & '123 abc' ---
408string(8) "21302220"
409--- testing: 'a5.9' & '123abc ' ---
410string(8) "21302221"
411--- testing: 'a5.9' & '3.4a' ---
412string(8) "21242421"
413--- testing: 'a5.9' & 'a5.9' ---
414string(8) "61352e39"
415