It may be obvious question, but I don't understand how does it work.
For the following code in PHP:
$connection = new mysqli("host","user","password","database");
$result = $connection->query("SELECT * FROM `table`;");
if($result)
{
// do something
}
I don't understand how it is possible to make an operation if ($result) on object since it's not a simple bool variable, but collection of variables and methods.
How is it possible?
How does this mechanism work?
Can I make my own objects that also allow to make "invisible" bool variable in it?