Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16647 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70878 invoked by uid 1010); 14 Jun 2005 04:08:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70863 invoked from network); 14 Jun 2005 04:08:39 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 14 Jun 2005 04:08:39 -0000 X-Host-Fingerprint: 195.28.69.139 mail.jobtion.com Linux 2.4 w/o timestamps Received: from ([195.28.69.139:42357] helo=sparky.datcon.sk) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 3A/77-20931-4485EA24 for ; Tue, 14 Jun 2005 00:08:36 -0400 Received: from localhost (localhost [127.0.0.1]) by sparky.datcon.sk (Postfix) with ESMTP id 3ED6414FFD for ; Tue, 14 Jun 2005 06:08:33 +0200 (CEST) Received: from sparky.datcon.sk ([127.0.0.1]) by localhost (sparky [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02944-01-3 for ; Tue, 14 Jun 2005 06:08:33 +0200 (CEST) Received: from [172.16.71.217] (adsl90.212-5-195.telecom.sk [212.5.195.90]) by sparky.datcon.sk (Postfix) with ESMTP id 17AF314FF3 for ; Tue, 14 Jun 2005 06:08:33 +0200 (CEST) Message-ID: <42AE5845.70307@kmit.sk> Date: Tue, 14 Jun 2005 06:08:37 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050518 X-Accept-Language: sk, en MIME-Version: 1.0 Cc: internals@lists.php.net References: <5.1.0.14.2.20050603203711.028e9140@localhost> <200506051859.53976.magnus@php.net> <6E.27.21296.C90E7A24@pb1.pair.com> <38.CE.21296.BFD78A24@pb1.pair.com> <43.34.20931.17BEDA24@pb1.pair.com> <1118701987.27553.6.camel@blobule.suds> <53F92510-14F5-4E4E-939F-8FC382A7B925@botimer.net> <87728790.20050613214458@ionzoft.com> In-Reply-To: <87728790.20050613214458@ionzoft.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at datcon.sk Subject: Re: [PHP-DEV] PHP 5.1 From: ondrej@kmit.sk (=?UTF-8?B?T25kcmVqIEl2YW5pxI0=?=) 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)