note 3572 modified in function.error-reporting by felipe

From: Date: Sun, 20 Jul 2008 23:30:29 +0000
Subject: note 3572 modified in function.error-reporting by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142348@lists.php.net to get a copy of this message
The E_NOTICE error reporting level reports the use of undefined variables as an error. For example: error_reporting(E_ALL); # Set error reporting to highest level if ($foo) # This will generate an error print "bar"; # because $foo is not defined To avoid this behavior, use isset to test if the given variable has been defined. For example: error_reporting(E_ALL); if (isset ($foo)) print "bar"; --was-- The E_NOTICE error reporting level reports the use of undefined variables as an error. For example: error_level (E_ALL); # Set error reporting to highest level if ($foo) # This will generate an error print "bar"; # because $foo is not defined To avoid this behavior, use isset to test if the given variable has been defined. For example: error_level (E_ALL); if (isset ($foo)) print "bar"; http://php.net/manual/en/function.error-reporting.php

« previous php.notes (#142348) next »