News for hackers. Stuff that matters.
Re:Short array syntax finally in PHP 5.4 by nbpoole on Monday July 25, 2011 @12:00AM (#2801274)
They're notices, not warnings. They can be disabled via a simple call to the error_reporting function.

I fundamentally disagree with you though. For me, notices are very useful for identifying typos and other coding mistakes that can lead to incorrect behavior.

Consider the following lines of code:

    $user_info = array(
            'id'            => 1,
            'username'      => 'nbpoole',
            'is_guess'      => false
    );

    if (!$user_info['is_guest'])
    {
            echo 'Member stuff';
    }
When I run that script with error_reporting set to E_ALL, I get an "undefined index" notice pointing me to the line where I do the comparison: at that point, I can track down where in my code I misspelled the word guest. Without the notice, I might not immediately realize that the 'is_guest' index was mis-spelled somewhere.

There are no comments on this comment yet.