note 110851 added to types.comparisons

From: Date: Fri, 14 Dec 2012 18:14:34 +0000
Subject: note 110851 added to types.comparisons
Groups: php.notes 
Request: Send a blank email to php-notes+get-192537@lists.php.net to get a copy of this message
PHP's loose comparisons can be a huge convenience when used properly! It's extremely helpful to just remember the following are always FALSE: null, false, "", 0, "0", array() If your application never depends on a particular "empty/false/null/0/not set" value type, you won't have to worry about 99% of the other weird cases listed here. You won't need empty() or isset(). And ALL variable types will always work as expected for statements like: if(boolean && !string){...} if(array){...} if(!null || int){...} Consider the same when working with your database values. ---- Server IP: 69.147.83.199 Probable Submitter: 76.219.158.239 ---- Manual Page -- http://php.net/manual/en/types.comparisons.php Edit -- https://master.php.net/note/edit/110851 Del: integrated -- https://master.php.net/note/delete/110851/integrated Del: useless -- https://master.php.net/note/delete/110851/useless Del: bad code -- https://master.php.net/note/delete/110851/bad+code Del: spam -- https://master.php.net/note/delete/110851/spam Del: non-english -- https://master.php.net/note/delete/110851/non-english Del: in docs -- https://master.php.net/note/delete/110851/in+docs Del: other reasons-- https://master.php.net/note/delete/110851 Reject -- https://master.php.net/note/reject/110851 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192537) next »