Re: Re[2]: The 'at' sign (@) variable prefix
| From: | mike | Date: | Wed, 08 Oct 2008 19:01:01 +0000 |
| Subject: | Re: Re[2]: The 'at' sign (@) variable prefix | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281598@lists.php.net to get a copy of this message | ||
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