On 15 Mar 2012, at 18:35, Daniel Brown wrote: > On Thu, Mar 15, 2012 at 14:31, Stuart Dallas <stuart@xxxxxxxx> wrote: >> >> The @ prefix is banned from all code I go anywhere near - it's evil! I've used the following 'V' function for a long time, primarily for accessing the superglobals but it works for any array. >> >> <?php >> session_start(); >> $_SESSION['first_name'] = $first_name = V($_SESSION, 'first_name'); >> >> function V($arr, $key, $def = null) { >> return isset($arr[$key]) ? $arr[$key] : $def; >> } >> ?> > > For the most part, I agree with you, but for this particular > example, it simply silences the notice for an undefined variable, > should it not be set, at the time of the function call. In nearly any > other case, though, I'm totally with you. I've seen too many cases where one "acceptable" use of the @ leads to bugs being hidden, regardless of the original motivation. I prefer to handle things like this explicitly, but each to his own. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php