Re: @$_POST[...]

From: Date: Wed, 22 Apr 2009 23:32:40 +0000
Subject: Re: @$_POST[...]
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-291847@lists.php.net to get a copy of this message
Luke wrote:
2009/4/22 PJ <af.gourmet@videotron.ca>
Could somebody explain to me the meaning of @ in $var = @$_POST['title'] ; where could I find a cheat sheet for those kinds of symbols or what are they called? Sorry for my ignorance, but maybe this will take the fog filter our of my neurons. :-\
I believe placing an @ in front of a statement suppresses any error messages it generates.
It does - in this case if 'title' is not posted as part of the form, it would have generated a warning or notice (can't remember which). A longer path is: $var = ''; if (isset($_POST['title'])) { $var = $_POST['title']; } The shortcut works but it makes it extremely difficult to find problems with your scripts (think of 50 @'s being used in one script.. eek). -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#291847) next »