@morbiuswilters said:
Still, I've never found notices to be useful.
From our production log ("why are our orders not coming through?!"):
[Tue Mar 23 08:19:50 2010] (Language.class.php:25) [PHP notice] Undefined index: languageext
[Tue Mar 23 08:19:50 2010] (Language.class.php:25) [PHP notice] Undefined index: country
A lot of those errors are because of misspelt variables or forgetting to use a $, so PHP assumes you meant a constant (which was not defined) someVar
instead of a variable $someVar
. (The latter would result in having the actual string value "someVar"
.
@morbiuswilters said:
Meh, it's more verbose, adds function overhead and gets ugly real quick with multi-dimensional arrays.
Which is why I use isset/empty: if (isset($array[$key1][$key2]['foo'])) // will not trigger a notice if anything is unset
(First post; be gentle. And where is the preview function?!)