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