note 53296 deleted from function.empty by didou

From: Date: Sun, 18 May 2008 01:00:04 +0000
Subject: note 53296 deleted from function.empty by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-139490@lists.php.net to get a copy of this message
Note Submitter: shorty114 ---- In Response to Zigbigidorlu: Using if (!$_POST['foo']) is not the best way to test if a variable is empty/set. Doing that creates a E_WARNING error for an uninitialized variable, and if you are planning to use a rather high error level, this is not the better way, since this will create an error whereas if (!isset($_POST['foo'])) or (empty($_POST['foo'])) doesn't echo an error, just returns true/false appropriately. One example of this is in the phpBB code - the coding guidelines state that you have to use isset() or empty() to see if a variable is set, since they planned to use a higher level of error reporting.

« previous php.notes (#139490) next »