Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3946 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85442 invoked from network); 14 Aug 2003 18:18:14 -0000 Received: from unknown (HELO mail.3gstech.com) (216.239.132.110) by pb1.pair.com with SMTP; 14 Aug 2003 18:18:14 -0000 Received: from 3gstech.com (ip-209-172-92-41.us01.qualys.com [209.172.92.41]) by mail.3gstech.com (Postfix) with ESMTP id B04AB9E7B11; Thu, 14 Aug 2003 11:18:13 -0700 (PDT) Message-ID: <3F3BD1D7.70209@3gstech.com> Date: Thu, 14 Aug 2003 11:15:51 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: ilia@prohost.org Cc: Lars Torben Wilson , internals@lists.php.net References: <1060813541.901.336.camel@ali> <200308141145.38495.ilia@prohost.org> In-Reply-To: <200308141145.38495.ilia@prohost.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] variable_exists() patch From: waboring@3gstech.com (walt boring) Ilia Alshanetsky wrote: >Do we really need this function? I see 2 ways of 'implementing' this >functionality in PHP without having to add another function. For example: >(isset($var) || is_null($var)) or gettype($var). > >Ilia > > I for one would like to see something like variable_exists(), as I am very annoyed with the logic of isset() returning false if the variable exists and has a value of null. The name of the function in this case doesn't not fit the logic for isset(). The variable does exist and it IS in fact set, the value just so happens to be null. I constantly get puzzled looks and confusion, when I explain to folks that are new to php, that isset() really doesn't do what it's name suggests. I for one would much rather do if ( variable_exists($var) ) {} versus if (isset($var) || is_null($var)) {} it's less code to type and is less prone to errors. So I would like to see the patch in, or something similar in functionality, since isset() doesn't do what I'd expect. Walt