Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10331 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11590 invoked by uid 1010); 9 Jun 2004 00:23:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11565 invoked by uid 1007); 9 Jun 2004 00:23:44 -0000 Message-ID: <20040609002344.11563.qmail@pb1.pair.com> To: internals@lists.php.net Date: Wed, 09 Jun 2004 10:23:40 +1000 User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <20040608175939.47739.qmail@pb1.pair.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 144.137.54.82 Subject: Re: [PHP-DEV] 'false' - boolean interpratation From: nick_loeve@sputnikagency.com (Nick Loeve) Derrell Lipman wrote: > "Robert Janeczek" writes: > > >>is there any way that string 'false' (and its variations with capital >>letters) could be interpeted as boolean of value false? i have xml >>configuration file that has some switches (true/false) in it. when i use >>this values in functions that require booleans i get true every time (as >>string isn`t empty) :/ i hoped that at least with explicit type cast i could >>go around this problem, but i didn`t help. >>how about adding this special case to conversion rules? creating if`s around >>such code doesn`t make me happy at all :] > > > What do eval('false') and eval('true') return? You can probably just do > eval(xmlText) to get the results you're looking for. (Just beware that the > xmlText actually contains one of the values "true" or "false", and not some > malicious php code.) > > Derrell or use integers in the xml file and force type casting (integer)$xmlText