Re: Re[2]: The 'at' sign (@) variable prefix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2008-10-08 at 12:01 -0700, mike wrote:
> On Wed, Oct 8, 2008 at 4:06 AM, ANR Daemon <anrdaemon@xxxxxxxxxxx> wrote:
> 
> > If you're using it to deal with possible empty input data, you'd better do it
> > explicitly enstead.
> >
> > Something like this:
> >
> >  if(!array_key_exists('from_year', $_POST)
> >    || !array_key_exists('from_month', $_POST)
> >    || !array_key_exists('from_day', $_POST)
> >    )
> >  {
> >    throw new Exception('No start date given', 100);
> >  }
> 
> *cough*
> 
> filter_input does this elegantly too ;) as does an isset() on the array index
> 
I'm a fan of the isset() method for POST and GET variables, as usually
I'll still want to put something in the variables I'm assigning those
values to, rather than the NULL which gets returned by the @ prefix.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux