Re: PHP 5.1

From: Date: Tue, 14 Jun 2005 04:08:37 +0000
Subject: Re: PHP 5.1
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-16647@lists.php.net to get a copy of this message
Jason Garber wrote: > ifsetor is NOT input filtering, it is not a complex, general purpose stuff like 'ifsetof()' is good when is use as: > $x = ifsetor($ANY_var, 'Default Value'); but too many times I need additional checks like this: $x = isset($_REQUEST['x']) && is_number($x) ? $_REQUEST['x'] : null; It's possible to add additional third parameter to ifsetof() ? ifsetof(variable, expression [, callback]) callback is a function which take one argument (value of variable) and return true or false. If return false 'expression' will be return from ifsetor(). Usage: $x = ifsetor($_REQUEST['x'], null, 'is_number'); > It needs to be fast, and simple. Hm... It's simple, but It's not very clean at first look. What's your opinion? -- Ondrej Ivnaic (ondrej@kmit.sk)

« previous php.internals (#16647) next »