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      try {
17        var_dump($strVal<<$otherVal);
18      } catch (Throwable $e) {
19        echo "Exception: " . $e->getMessage() . "\n";
20      }
21   }
22}
23
24?>
25===DONE===
26--EXPECT--
27--- testing: '0' << '0' ---
28int(0)
29--- testing: '0' << '65' ---
30int(0)
31--- testing: '0' << '-44' ---
32Exception: Bit shift by negative number
33--- testing: '0' << '1.2' ---
34int(0)
35--- testing: '0' << '-7.7' ---
36Exception: Bit shift by negative number
37--- testing: '0' << 'abc' ---
38int(0)
39--- testing: '0' << '123abc' ---
40int(0)
41--- testing: '0' << '123e5' ---
42int(0)
43--- testing: '0' << '123e5xyz' ---
44int(0)
45--- testing: '0' << ' 123abc' ---
46int(0)
47--- testing: '0' << '123 abc' ---
48int(0)
49--- testing: '0' << '123abc ' ---
50int(0)
51--- testing: '0' << '3.4a' ---
52int(0)
53--- testing: '0' << 'a5.9' ---
54int(0)
55--- testing: '65' << '0' ---
56int(65)
57--- testing: '65' << '65' ---
58int(0)
59--- testing: '65' << '-44' ---
60Exception: Bit shift by negative number
61--- testing: '65' << '1.2' ---
62int(130)
63--- testing: '65' << '-7.7' ---
64Exception: Bit shift by negative number
65--- testing: '65' << 'abc' ---
66int(65)
67--- testing: '65' << '123abc' ---
68int(0)
69--- testing: '65' << '123e5' ---
70int(0)
71--- testing: '65' << '123e5xyz' ---
72int(0)
73--- testing: '65' << ' 123abc' ---
74int(0)
75--- testing: '65' << '123 abc' ---
76int(0)
77--- testing: '65' << '123abc ' ---
78int(0)
79--- testing: '65' << '3.4a' ---
80int(520)
81--- testing: '65' << 'a5.9' ---
82int(65)
83--- testing: '-44' << '0' ---
84int(-44)
85--- testing: '-44' << '65' ---
86int(0)
87--- testing: '-44' << '-44' ---
88Exception: Bit shift by negative number
89--- testing: '-44' << '1.2' ---
90int(-88)
91--- testing: '-44' << '-7.7' ---
92Exception: Bit shift by negative number
93--- testing: '-44' << 'abc' ---
94int(-44)
95--- testing: '-44' << '123abc' ---
96int(0)
97--- testing: '-44' << '123e5' ---
98int(0)
99--- testing: '-44' << '123e5xyz' ---
100int(0)
101--- testing: '-44' << ' 123abc' ---
102int(0)
103--- testing: '-44' << '123 abc' ---
104int(0)
105--- testing: '-44' << '123abc ' ---
106int(0)
107--- testing: '-44' << '3.4a' ---
108int(-352)
109--- testing: '-44' << 'a5.9' ---
110int(-44)
111--- testing: '1.2' << '0' ---
112int(1)
113--- testing: '1.2' << '65' ---
114int(0)
115--- testing: '1.2' << '-44' ---
116Exception: Bit shift by negative number
117--- testing: '1.2' << '1.2' ---
118int(2)
119--- testing: '1.2' << '-7.7' ---
120Exception: Bit shift by negative number
121--- testing: '1.2' << 'abc' ---
122int(1)
123--- testing: '1.2' << '123abc' ---
124int(0)
125--- testing: '1.2' << '123e5' ---
126int(0)
127--- testing: '1.2' << '123e5xyz' ---
128int(0)
129--- testing: '1.2' << ' 123abc' ---
130int(0)
131--- testing: '1.2' << '123 abc' ---
132int(0)
133--- testing: '1.2' << '123abc ' ---
134int(0)
135--- testing: '1.2' << '3.4a' ---
136int(8)
137--- testing: '1.2' << 'a5.9' ---
138int(1)
139--- testing: '-7.7' << '0' ---
140int(-7)
141--- testing: '-7.7' << '65' ---
142int(0)
143--- testing: '-7.7' << '-44' ---
144Exception: Bit shift by negative number
145--- testing: '-7.7' << '1.2' ---
146int(-14)
147--- testing: '-7.7' << '-7.7' ---
148Exception: Bit shift by negative number
149--- testing: '-7.7' << 'abc' ---
150int(-7)
151--- testing: '-7.7' << '123abc' ---
152int(0)
153--- testing: '-7.7' << '123e5' ---
154int(0)
155--- testing: '-7.7' << '123e5xyz' ---
156int(0)
157--- testing: '-7.7' << ' 123abc' ---
158int(0)
159--- testing: '-7.7' << '123 abc' ---
160int(0)
161--- testing: '-7.7' << '123abc ' ---
162int(0)
163--- testing: '-7.7' << '3.4a' ---
164int(-56)
165--- testing: '-7.7' << 'a5.9' ---
166int(-7)
167--- testing: 'abc' << '0' ---
168int(0)
169--- testing: 'abc' << '65' ---
170int(0)
171--- testing: 'abc' << '-44' ---
172Exception: Bit shift by negative number
173--- testing: 'abc' << '1.2' ---
174int(0)
175--- testing: 'abc' << '-7.7' ---
176Exception: Bit shift by negative number
177--- testing: 'abc' << 'abc' ---
178int(0)
179--- testing: 'abc' << '123abc' ---
180int(0)
181--- testing: 'abc' << '123e5' ---
182int(0)
183--- testing: 'abc' << '123e5xyz' ---
184int(0)
185--- testing: 'abc' << ' 123abc' ---
186int(0)
187--- testing: 'abc' << '123 abc' ---
188int(0)
189--- testing: 'abc' << '123abc ' ---
190int(0)
191--- testing: 'abc' << '3.4a' ---
192int(0)
193--- testing: 'abc' << 'a5.9' ---
194int(0)
195--- testing: '123abc' << '0' ---
196int(123)
197--- testing: '123abc' << '65' ---
198int(0)
199--- testing: '123abc' << '-44' ---
200Exception: Bit shift by negative number
201--- testing: '123abc' << '1.2' ---
202int(246)
203--- testing: '123abc' << '-7.7' ---
204Exception: Bit shift by negative number
205--- testing: '123abc' << 'abc' ---
206int(123)
207--- testing: '123abc' << '123abc' ---
208int(0)
209--- testing: '123abc' << '123e5' ---
210int(0)
211--- testing: '123abc' << '123e5xyz' ---
212int(0)
213--- testing: '123abc' << ' 123abc' ---
214int(0)
215--- testing: '123abc' << '123 abc' ---
216int(0)
217--- testing: '123abc' << '123abc ' ---
218int(0)
219--- testing: '123abc' << '3.4a' ---
220int(984)
221--- testing: '123abc' << 'a5.9' ---
222int(123)
223--- testing: '123e5' << '0' ---
224int(12300000)
225--- testing: '123e5' << '65' ---
226int(0)
227--- testing: '123e5' << '-44' ---
228Exception: Bit shift by negative number
229--- testing: '123e5' << '1.2' ---
230int(24600000)
231--- testing: '123e5' << '-7.7' ---
232Exception: Bit shift by negative number
233--- testing: '123e5' << 'abc' ---
234int(12300000)
235--- testing: '123e5' << '123abc' ---
236int(0)
237--- testing: '123e5' << '123e5' ---
238int(0)
239--- testing: '123e5' << '123e5xyz' ---
240int(0)
241--- testing: '123e5' << ' 123abc' ---
242int(0)
243--- testing: '123e5' << '123 abc' ---
244int(0)
245--- testing: '123e5' << '123abc ' ---
246int(0)
247--- testing: '123e5' << '3.4a' ---
248int(98400000)
249--- testing: '123e5' << 'a5.9' ---
250int(12300000)
251--- testing: '123e5xyz' << '0' ---
252int(12300000)
253--- testing: '123e5xyz' << '65' ---
254int(0)
255--- testing: '123e5xyz' << '-44' ---
256Exception: Bit shift by negative number
257--- testing: '123e5xyz' << '1.2' ---
258int(24600000)
259--- testing: '123e5xyz' << '-7.7' ---
260Exception: Bit shift by negative number
261--- testing: '123e5xyz' << 'abc' ---
262int(12300000)
263--- testing: '123e5xyz' << '123abc' ---
264int(0)
265--- testing: '123e5xyz' << '123e5' ---
266int(0)
267--- testing: '123e5xyz' << '123e5xyz' ---
268int(0)
269--- testing: '123e5xyz' << ' 123abc' ---
270int(0)
271--- testing: '123e5xyz' << '123 abc' ---
272int(0)
273--- testing: '123e5xyz' << '123abc ' ---
274int(0)
275--- testing: '123e5xyz' << '3.4a' ---
276int(98400000)
277--- testing: '123e5xyz' << 'a5.9' ---
278int(12300000)
279--- testing: ' 123abc' << '0' ---
280int(123)
281--- testing: ' 123abc' << '65' ---
282int(0)
283--- testing: ' 123abc' << '-44' ---
284Exception: Bit shift by negative number
285--- testing: ' 123abc' << '1.2' ---
286int(246)
287--- testing: ' 123abc' << '-7.7' ---
288Exception: Bit shift by negative number
289--- testing: ' 123abc' << 'abc' ---
290int(123)
291--- testing: ' 123abc' << '123abc' ---
292int(0)
293--- testing: ' 123abc' << '123e5' ---
294int(0)
295--- testing: ' 123abc' << '123e5xyz' ---
296int(0)
297--- testing: ' 123abc' << ' 123abc' ---
298int(0)
299--- testing: ' 123abc' << '123 abc' ---
300int(0)
301--- testing: ' 123abc' << '123abc ' ---
302int(0)
303--- testing: ' 123abc' << '3.4a' ---
304int(984)
305--- testing: ' 123abc' << 'a5.9' ---
306int(123)
307--- testing: '123 abc' << '0' ---
308int(123)
309--- testing: '123 abc' << '65' ---
310int(0)
311--- testing: '123 abc' << '-44' ---
312Exception: Bit shift by negative number
313--- testing: '123 abc' << '1.2' ---
314int(246)
315--- testing: '123 abc' << '-7.7' ---
316Exception: Bit shift by negative number
317--- testing: '123 abc' << 'abc' ---
318int(123)
319--- testing: '123 abc' << '123abc' ---
320int(0)
321--- testing: '123 abc' << '123e5' ---
322int(0)
323--- testing: '123 abc' << '123e5xyz' ---
324int(0)
325--- testing: '123 abc' << ' 123abc' ---
326int(0)
327--- testing: '123 abc' << '123 abc' ---
328int(0)
329--- testing: '123 abc' << '123abc ' ---
330int(0)
331--- testing: '123 abc' << '3.4a' ---
332int(984)
333--- testing: '123 abc' << 'a5.9' ---
334int(123)
335--- testing: '123abc ' << '0' ---
336int(123)
337--- testing: '123abc ' << '65' ---
338int(0)
339--- testing: '123abc ' << '-44' ---
340Exception: Bit shift by negative number
341--- testing: '123abc ' << '1.2' ---
342int(246)
343--- testing: '123abc ' << '-7.7' ---
344Exception: Bit shift by negative number
345--- testing: '123abc ' << 'abc' ---
346int(123)
347--- testing: '123abc ' << '123abc' ---
348int(0)
349--- testing: '123abc ' << '123e5' ---
350int(0)
351--- testing: '123abc ' << '123e5xyz' ---
352int(0)
353--- testing: '123abc ' << ' 123abc' ---
354int(0)
355--- testing: '123abc ' << '123 abc' ---
356int(0)
357--- testing: '123abc ' << '123abc ' ---
358int(0)
359--- testing: '123abc ' << '3.4a' ---
360int(984)
361--- testing: '123abc ' << 'a5.9' ---
362int(123)
363--- testing: '3.4a' << '0' ---
364int(3)
365--- testing: '3.4a' << '65' ---
366int(0)
367--- testing: '3.4a' << '-44' ---
368Exception: Bit shift by negative number
369--- testing: '3.4a' << '1.2' ---
370int(6)
371--- testing: '3.4a' << '-7.7' ---
372Exception: Bit shift by negative number
373--- testing: '3.4a' << 'abc' ---
374int(3)
375--- testing: '3.4a' << '123abc' ---
376int(0)
377--- testing: '3.4a' << '123e5' ---
378int(0)
379--- testing: '3.4a' << '123e5xyz' ---
380int(0)
381--- testing: '3.4a' << ' 123abc' ---
382int(0)
383--- testing: '3.4a' << '123 abc' ---
384int(0)
385--- testing: '3.4a' << '123abc ' ---
386int(0)
387--- testing: '3.4a' << '3.4a' ---
388int(24)
389--- testing: '3.4a' << 'a5.9' ---
390int(3)
391--- testing: 'a5.9' << '0' ---
392int(0)
393--- testing: 'a5.9' << '65' ---
394int(0)
395--- testing: 'a5.9' << '-44' ---
396Exception: Bit shift by negative number
397--- testing: 'a5.9' << '1.2' ---
398int(0)
399--- testing: 'a5.9' << '-7.7' ---
400Exception: Bit shift by negative number
401--- testing: 'a5.9' << 'abc' ---
402int(0)
403--- testing: 'a5.9' << '123abc' ---
404int(0)
405--- testing: 'a5.9' << '123e5' ---
406int(0)
407--- testing: 'a5.9' << '123e5xyz' ---
408int(0)
409--- testing: 'a5.9' << ' 123abc' ---
410int(0)
411--- testing: 'a5.9' << '123 abc' ---
412int(0)
413--- testing: 'a5.9' << '123abc ' ---
414int(0)
415--- testing: 'a5.9' << '3.4a' ---
416int(0)
417--- testing: 'a5.9' << 'a5.9' ---
418int(0)
419===DONE===
420