xref: /PHP-8.2/Zend/tests/self_xor.phpt (revision b2248789)
1--TEST--
2XORing strings
3--FILE--
4<?php
5
6$s = "123";
7$s1 = "test";
8$s2 = "45345some";
9$s3 = str_repeat("f", 1);
10$s4 = str_repeat("f", 2);
11
12$s ^= 22;
13var_dump($s);
14
15try {
16    $s1 ^= 11;
17    var_dump($s1);
18} catch (\TypeError $e) {
19    echo $e->getMessage() . \PHP_EOL;
20}
21
22$s2 ^= 33;
23var_dump($s2);
24
25$s3 ^= " ";
26var_dump($s3);
27
28$s4 ^= "  ";
29var_dump($s4);
30
31echo "Done\n";
32?>
33--EXPECTF--
34int(109)
35Unsupported operand types: string ^ int
36
37Warning: A non-numeric value encountered in %s on line %d
38int(45312)
39string(1) "F"
40string(2) "FF"
41Done
42