Hi Ken,

This is definitely an interesting idea, and when described as "the opposite of ??" the !?? syntax makes sense.

Looking at the example, though, the "negating" part becomes a bit confusing.

The verbose form reads naturally as a positive assertion - "if this is set, do this":
         if (isset($_SERVER['fname']) {
             $user->setName($_SERVER['fname']);
         }


If we used the ?? operator, it would be a negative, "if this is not set, do this":

         $_SERVER['fname'] ?? $user->unsetName();

So the short-hand form becomes a kind of double negative - "if this is not set, don't do this", or "if this is not not set, do this":

         $_SERVER['fname'] !?? $user->setName($_SERVER['fname']);


That makes me think that the choice of syntax isn't quite right, but I'm not sure what to suggest instead.


Regards,

--
Rowan Tommins (né Collins)
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to