Requesting new magic method: `__toBoolean()`
What if you only want to display your active users in a very simple way? Consider the following:
$emily = new User('Emily'); $emily->active = false; $sara = new User('Sara');
$users = array($emily, $sara); foreach($users as $user) { if($user) { echo $user->getName(); } }
The __toBoolean() would in some ways be equivalent to the method FilterIterator::accept().