xref: /PHP-7.2/Zend/tests/add_006.phpt (revision f1d7e3ca)
1--TEST--
2adding numbers to strings
3--INI--
4precision=14
5--FILE--
6<?php
7
8$i = 75636;
9$s1 = "this is a string";
10$s2 = "876222numeric";
11$s3 = "48474874";
12$s4 = "25.68";
13
14$c = $i + $s1;
15var_dump($c);
16
17$c = $i + $s2;
18var_dump($c);
19
20$c = $i + $s3;
21var_dump($c);
22
23$c = $i + $s4;
24var_dump($c);
25
26$c = $s1 + $i;
27var_dump($c);
28
29$c = $s2 + $i;
30var_dump($c);
31
32$c = $s3 + $i;
33var_dump($c);
34
35$c = $s4 + $i;
36var_dump($c);
37
38echo "Done\n";
39?>
40--EXPECTF--
41Warning: A non-numeric value encountered in %s on line %d
42int(75636)
43
44Notice: A non well formed numeric value encountered in %s on line %d
45int(951858)
46int(48550510)
47float(75661.68)
48
49Warning: A non-numeric value encountered in %s on line %d
50int(75636)
51
52Notice: A non well formed numeric value encountered in %s on line %d
53int(951858)
54int(48550510)
55float(75661.68)
56Done
57