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

From: Date: Wed, 08 Oct 2008 19:08:37 +0000
Subject: Re: Re[2]: The 'at' sign (@) variable prefix
References: 1 2 3 4 5 6 7 8  Groups: php.general 
Request: Send a blank email to php-general+get-281600@lists.php.net to get a copy of this message
On Wed, 2008-10-08 at 12:01 -0700, mike wrote: > On Wed, Oct 8, 2008 at 4:06 AM, ANR Daemon <anrdaemon@freemail.ru> 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

« previous php.general (#281600) next »