xref: /PHP-8.3/Zend/tests/shift_001.phpt (revision b2248789)
1--TEST--
2shifting strings left
3--FILE--
4<?php
5
6$s = "123";
7$s1 = "test";
8$s2 = "45345some";
9
10$s <<= 2;
11var_dump($s);
12
13try {
14    $s1 <<= 1;
15    var_dump($s1);
16} catch (\TypeError $e) {
17    echo $e->getMessage() . \PHP_EOL;
18}
19
20$s2 <<= 3;
21var_dump($s2);
22
23echo "Done\n";
24?>
25--EXPECTF--
26int(492)
27Unsupported operand types: string << int
28
29Warning: A non-numeric value encountered in %s on line %d
30int(362760)
31Done
32