On Thu, Apr 14, 2011 at 10:05 AM, Hannes Landeholm <landeh...@gmail.com>wrote:

> Trying to summarize this discussion... I think we can all agree that the
> main problem is "code duplication for array access when parameters are
> possibly not existing". I think we all can also agree that @ can be both
> used properly and misused - and it is a blunt tool and not a nice solution
> to the previously stated problem.
>
> Some suggested that the ternary if comparison should suppress the notice
> automatically. This would break existing code and also be confusing since
> people expect a ternary if and normal if to work the same way.
>
> Some suggested ?? as an array access operator that suppresses the notice
> and
> has 3 variants: A: nothing specified - uses null as default, B: has default
> specified, C: returns X if index exists or Y if index doesn't exist. This
> effectively solves the code duplication problem and is a shortcut for
> saying
> "the array index may or may not exist".
>
> One person said that the relation between ? and ?? and == and === would
> make
> the operator non-intuitive. Other people disagreed and claimed the
> opposite.
>
> So basically the discussion now is what exact characters that should be
> used
> to represent this operator? I really hope we can get this implemented
> quickly... I worked with $_POST yesterday and I could really use that ??
> operator.
>
> ~Hannes
>

There was also my suggestion of a "checked ternary" operator [see my
previous email in this thread.] Backwards compatible, practical, and simple.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

Reply via email to