xref: /PHP-8.3/Zend/tests/objects_001.phpt (revision 782352c5)
1--TEST--
2comparing objects to other types
3--FILE--
4<?php
5
6class Bar {
7}
8
9$b = new Bar;
10
11var_dump($b == NULL);
12var_dump($b != NULL);
13var_dump($b == true);
14var_dump($b != true);
15var_dump($b == false);
16var_dump($b != false);
17var_dump($b == "");
18var_dump($b != "");
19var_dump($b == 0);
20var_dump($b != 0);
21var_dump($b == 1);
22var_dump($b != 1);
23var_dump($b == 1.0);
24var_dump($b != 1.0);
25var_dump($b == 1);
26
27
28echo "Done\n";
29?>
30--EXPECTF--
31bool(false)
32bool(true)
33bool(true)
34bool(false)
35bool(false)
36bool(true)
37bool(false)
38bool(true)
39
40Notice: Object of class Bar could not be converted to int in %s on line %d
41bool(false)
42
43Notice: Object of class Bar could not be converted to int in %s on line %d
44bool(true)
45
46Notice: Object of class Bar could not be converted to int in %s on line %d
47bool(true)
48
49Notice: Object of class Bar could not be converted to int in %s on line %d
50bool(false)
51
52Notice: Object of class Bar could not be converted to float in %s on line %d
53bool(true)
54
55Notice: Object of class Bar could not be converted to float in %s on line %d
56bool(false)
57
58Notice: Object of class Bar could not be converted to int in %s on line %d
59bool(true)
60Done
61