note 62442 deleted from function.empty by cmb

From: Date: Sun, 01 Dec 2019 09:23:40 +0000
Subject: note 62442 deleted from function.empty by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213360@lists.php.net to get a copy of this message
Note Submitter: nobody at example dot com ---- Re: inerte is my gmail.com username's comment: While that may be true, those two statements (empty($var), $var == '') are NOT the same. When programming for web interfaces, where a user may be submitting '0' as a valid field value, you should not be using empty(). <?php $str = '0'; // outputs 'empty' echo empty($str) ? 'empty' : 'not empty'; // outputs 'not empty' echo $str == '' ? 'empty' : 'not empty'; ?>

« previous php.notes (#213360) next »