xref: /PHP-8.0/Zend/tests/add_007.phpt (revision cdaf3503)
1--TEST--
2adding strings to arrays
3--FILE--
4<?php
5
6$a = array(1,2,3);
7
8$s1 = "some string";
9
10try {
11    var_dump($a + $s1);
12} catch (Error $e) {
13    echo "\nException: " . $e->getMessage() . "\n";
14}
15
16$c = $a + $s1;
17var_dump($c);
18
19echo "Done\n";
20?>
21--EXPECTF--
22Exception: Unsupported operand types: array + string
23
24Fatal error: Uncaught TypeError: Unsupported operand types: array + string in %s:%d
25Stack trace:
26#0 {main}
27  thrown in %s on line %d
28