Re: @$_POST[...]
| From: | PJ | Date: | Thu, 23 Apr 2009 17:07:09 +0000 |
| Subject: | Re: @$_POST[...] | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291880@lists.php.net to get a copy of this message | ||
Chris wrote:
> 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).
>
Thanks for refreshing my memory... I had run across this but forgot as I
usually do not use it. I turn on all error checking and stumble through
prin_r() and var_dump() ... whatever. :-D
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php