It seems that there are no consensus about this feature so... *if in doubt, leave it out.*
Martin Scotta On Mon, Apr 11, 2011 at 5:09 PM, Chris Stockton <chrisstockto...@gmail.com>wrote: > Hello, > > On Mon, Apr 11, 2011 at 11:47 AM, Matthew Weier O'Phinney > <weierophin...@php.net> wrote: > > On 2011-04-11, Stas Malyshev <smalys...@sugarcrm.com> wrote: > >> > I might come off rather crumudgeonly here, but these last few > >> > threads I've seen going across to silence notices have a common > >> > theme - "I wanna be a lazier coder." > > My suggestion to use ?? I will say has little to do with laziness. I > would be happy with any solution that solves my problem, I just know > that implementing a patch for ?? would be simple enough (I could even > do so if requested). Everyone has different use patterns as shown in > other examples, this is natural and just comes with the domain. > However, you may find 415,000 reasons why this feature could be useful > for developers in [1]. > > I also really like the <whatevername>($foo['not exists'], $config['not > exists'], $foo, $bar, 'default') function. I personally only usually > need 1 default value but I feel like many people may find uses for > this as well. > > In addition I would like to mention that the checking being "isset" > for such a feature would be a very reasonable option, seeing as empty > [2], array_key_exists [3] (7000 uses found only) etc type use cases > are probably going to be a big minority. Most of the time checks done > with empty() seem to be done on known or already isset() checked, I.E. > isset($foo['bar']) && !empty($foo['bar']) anyways. > > Just some food for thought, > > -Chris > > [1] > http://www.google.com/codesearch?hl=en&lr=&q=.*isset\%28.%2B%3F\%29[\s]{0%2C1}\%3F&sbtn=Search<http://www.google.com/codesearch?hl=en&lr=&q=.*isset%5C%28.%2B%3F%5C%29[%5Cs]%7B0%2C1%7D%5C%3F&sbtn=Search> > [2] > http://www.google.com/codesearch?hl=en&lr=&q=file%3A.*php+.*empty\%28.%2B%3F\%29[\s]{0%2C1}\%3F&sbtn=Search<http://www.google.com/codesearch?hl=en&lr=&q=file%3A.*php+.*empty%5C%28.%2B%3F%5C%29[%5Cs]%7B0%2C1%7D%5C%3F&sbtn=Search> > [3] > http://www.google.com/codesearch?hl=en&lr=&q=.*array_key_exists\%28.%2B%3F\%29[\s]{0%2C1}\%3F&sbtn=Search<http://www.google.com/codesearch?hl=en&lr=&q=.*array_key_exists%5C%28.%2B%3F%5C%29[%5Cs]%7B0%2C1%7D%5C%3F&sbtn=Search> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >