note 93300 added to language.operators.errorcontrol

From: Date: Wed, 02 Sep 2009 02:22:41 +0000
Subject: note 93300 added to language.operators.errorcontrol
Groups: php.notes 
Request: Send a blank email to php-notes+get-160146@lists.php.net to get a copy of this message
Though error suppression can be dangerous at times, it can be useful as well. I've found the following statements roughly equivalent: if( isset( $var ) && $var === $something ) if( @$var === $something ) EXCEPT when you're comparing against a boolean value (when $something is false). In that case, if it's not set the conditional will still be triggered. I've found this useful when I want to check a value that might not exist: if( @$_SERVER[ 'HTTP_REFERER' ] !== '/www/some/path/file' ) or when we want to see if a checkbox / radio button have been submitted with a post action if( @$_POST[ 'checkbox' ] === 'yes' ) Just letting you guys know my findings, :) ---- Server IP: 69.147.83.197 Probable Submitter: 71.136.198.195 ---- Manual Page -- http://www.php.net/manual/en/language.operators.errorcontrol.php Edit -- https://master.php.net/note/edit/93300 Del: integrated -- https://master.php.net/note/delete/93300/integrated Del: useless -- https://master.php.net/note/delete/93300/useless Del: bad code -- https://master.php.net/note/delete/93300/bad+code Del: spam -- https://master.php.net/note/delete/93300/spam Del: non-english -- https://master.php.net/note/delete/93300/non-english Del: in docs -- https://master.php.net/note/delete/93300/in+docs Del: other reasons-- https://master.php.net/note/delete/93300 Reject -- https://master.php.net/note/reject/93300 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160146) next »