Re: Implicit isset in ternary operator

From: Date: Wed, 01 Aug 2012 18:25:18 +0000
Subject: Re: Implicit isset in ternary operator
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
2012/8/1 Christoph Hochstrasser <[email protected]>:
> I'm lately using @$var["key"] a lot (despite it's slowness) and I like it a
> lot. It makes
> most code a lot more readable. I would be +1 for it, if we can make it fast.
>
> I think most people (me included) want only to avoid the notice for accessing undefined array
> offsets. What if we just remove the notice for accessing undefined array offsets, because it's
> the most common use case?

Getting philosophical. It's the same as if you want to read a page in
a book, but that page doesn't exist. For example a book with 40 pages,
but you want to read page 42. :) Is it an error to try it? Yes,
because if possible without error, you could do the same with the
universe and look at a part of it that doesn't exist. Someone has to
create it first. :)

More serious: For me it's the other way arround, it's one of the best
things, that have been introduced, because before it, a very small
write error had big impacts.

I see - as you - the need to make simple things more short, but
removing warnings from existing code constructs is definitly the wrong
way.

-- 
Alex Aulbach


Thread (31 messages)

« previous php.internals (#61938) next »