xref: /PHP-8.1/Zend/tests/concat_001.phpt (revision f8d79582)
1--TEST--
2concat different types
3--INI--
4precision=14
5--FILE--
6<?php
7
8class test {
9    function __toString() {
10        return "this is test object";
11    }
12}
13
14$a = array(1,2,3);
15$o = new test;
16$s = "some string";
17$i = 222;
18$d = 2323.444;
19
20var_dump($a.$o);
21var_dump($a.$s);
22var_dump($a.$i);
23var_dump($a.$d);
24var_dump($a.$a);
25
26var_dump($o.$a);
27var_dump($o.$s);
28var_dump($o.$i);
29var_dump($o.$d);
30var_dump($o.$o);
31
32var_dump($s.$o);
33var_dump($s.$a);
34var_dump($s.$i);
35var_dump($s.$d);
36var_dump($s.$s);
37
38var_dump($i.$a);
39var_dump($i.$o);
40var_dump($i.$s);
41var_dump($i.$d);
42var_dump($i.$i);
43
44var_dump($d.$a);
45var_dump($d.$o);
46var_dump($d.$s);
47var_dump($d.$i);
48var_dump($d.$d);
49
50echo "Done\n";
51?>
52--EXPECTF--
53Warning: Array to string conversion in %s on line %d
54string(24) "Arraythis is test object"
55
56Warning: Array to string conversion in %s on line %d
57string(16) "Arraysome string"
58
59Warning: Array to string conversion in %s on line %d
60string(8) "Array222"
61
62Warning: Array to string conversion in %s on line %d
63string(13) "Array2323.444"
64
65Warning: Array to string conversion in %s on line %d
66
67Warning: Array to string conversion in %s on line %d
68string(10) "ArrayArray"
69
70Warning: Array to string conversion in %s on line %d
71string(24) "this is test objectArray"
72string(30) "this is test objectsome string"
73string(22) "this is test object222"
74string(27) "this is test object2323.444"
75string(38) "this is test objectthis is test object"
76string(30) "some stringthis is test object"
77
78Warning: Array to string conversion in %s on line %d
79string(16) "some stringArray"
80string(14) "some string222"
81string(19) "some string2323.444"
82string(22) "some stringsome string"
83
84Warning: Array to string conversion in %s on line %d
85string(8) "222Array"
86string(22) "222this is test object"
87string(14) "222some string"
88string(11) "2222323.444"
89string(6) "222222"
90
91Warning: Array to string conversion in %s on line %d
92string(13) "2323.444Array"
93string(27) "2323.444this is test object"
94string(19) "2323.444some string"
95string(11) "2323.444222"
96string(16) "2323.4442323.444"
97Done
98