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