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