note 125703 added to function.is-null

From: Date: Wed, 20 Jan 2021 17:09:42 +0000
Subject: note 125703 added to function.is-null
Groups: php.notes 
Request: Send a blank email to php-notes+get-216208@lists.php.net to get a copy of this message
I've found that for HTTP requests such as POST, is_null isn't the most reliable choice for checking if empty. Try using if(trim($var) == ""){ // do something } instead. I think the request does something to the input that makes it definitely not NULL. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.166 (proxied: 102.89.0.190) ---- Manual Page -- http://php.net/manual/en/function.is-null.php Edit -- https://master.php.net/note/edit/125703 Del: integrated -- https://master.php.net/note/delete/125703/integrated Del: useless -- https://master.php.net/note/delete/125703/useless Del: bad code -- https://master.php.net/note/delete/125703/bad+code Del: spam -- https://master.php.net/note/delete/125703/spam Del: non-english -- https://master.php.net/note/delete/125703/non-english Del: in docs -- https://master.php.net/note/delete/125703/in+docs Del: other reasons-- https://master.php.net/note/delete/125703 Reject -- https://master.php.net/note/reject/125703 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#216208) next »