Nope. I prefer to treat "invalid" or "non existing" basic types as them
being set to a default value. This makes the input handler very robust and I
don't have to waste time by writing code that handles failed validation.

For example if I read an integer from $_POST I'd simply write:

$value = \intval(@$_POST["field"]);

(or a boolean:)

$value = (@$_POST["field"] == "set");

I'd prefer this syntax though:

$value = \intval($_POST["field"]??);


..simply because it's a more precise expression and no notice is generated
and have to be ignored when running the custom error handler - so it should
be faster too.

~Hannes

On 14 April 2011 18:08, Ole Markus With <olemar...@olemarkus.org> wrote:

> On Thu, 14 Apr 2011 16:05:45 +0200, Hannes Landeholm <landeh...@gmail.com>
> wrote:
>
>  So basically the discussion now is what exact characters that should be
>> used
>> to represent this operator? I really hope we can get this implemented
>> quickly... I worked with $_POST yesterday and I could really use that ??
>> operator.
>>
>>
> When it comes to $_POST you probably want to use filter_input instead.
>
> Cheers,
> Ole Markus With
>

Reply via email to