RE: [PHP] isset question

From: Date: Fri, 19 Jun 2009 11:36:35 +0000
Subject: RE: [PHP] isset question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-294318@lists.php.net to get a copy of this message
On 18 June 2009 20:25, LAMP advised: > using !empty() instead isset() will work if you don't care for PHP > Notice: Undefined variable... If you want to avoid PHP Notice > you have > to use both: > > $msg.= (isset($_POST['mort']) and !empty($_POST['mort'])) ? "The > mortgage amount is $mort\n" : " "; Absolute rubbish -- as it says at http://php.net/empty, "empty($var) is the opposite of (boolean)$var, except that no warning is generated when the variable is not set." -- so "protecting" empty() with an isset() is a total waste of time, space and cpu cycles. Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

« previous php.general (#294318) next »