On Apr 07 18:03:48, Rasmus Lerdorf wrote:
> On 4/7/11 5:59 PM, Matthew Weier O'Phinney wrote:
> > It may change the semantics as they stand, but I'd argue that the
> > _expectation_ from the shorthand ternary is to shorten code that
> > currently uses isset(). As it is, I have almost no use for it at this
> > point, as I end up needing to do:
> >
> >      $value = isset($a[$key]) ? $a[$key] : 'Not set';
> >
> > which is exactly the situation I had before it was introduced.
> 
> Not sure why you would have that expectation. The long ternary doesn't 
> do that, and there is nothing about the short ternary that changes that. 
> There was talk of a new ifsetor type of operator to have those semantics 
> but never any talk of changing existing semantics.

Well it could (and I believe that was the intention) call !empty instead
of isset, that way the semantics would not be changed, appart from the
lack of error for undefined variables.

Best,

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

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

Reply via email to