note 93300 deleted from language.operators.errorcontrol by peehaa

From: Date: Wed, 19 Apr 2017 12:22:30 +0000
Subject: note 93300 deleted from language.operators.errorcontrol by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209028@lists.php.net to get a copy of this message
Note Submitter: dsbeam at gmail dot com ---- 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, :)

« previous php.notes (#209028) next »