|
From: | Laurent Destailleur (eldy) |
Subject: | Re: [Dolibarr-dev] Start using booleans instead of integers acting like booleans |
Date: | Mon, 06 Aug 2012 01:44:00 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
Le 06/08/2012 01:17, Marcos García a
écrit :
Hello, This should not happen because when a variable int is used as a boolean, we want 0 to be false and 1 to be true. And this is the defautl behaviour of PHP: 0=false 1=true We simply should never use boolean but we prefer using integer with rule (0=false, 1 or other = true). When we need a third value (2), we can replace test if ($var) with if ($var==1) or if ($var ==2) according to what we want to do. That's why we must only use integer. Boolean is a type very useless and we often need to modify to support a third value, so let's start from scratch with directly int. Even if at the beginning, we need only 2 values.
-- Eldy (Laurent Destailleur). --------------------------------------------------------------- EMail: address@hidden Web: http://www.destailleur.fr Dolibarr (Project leader): http://www.dolibarr.org To make a donation for Dolibarr project via Paypal: address@hidden AWStats (Author) : http://awstats.sourceforge.net To make a donation for AWStats project via Paypal: address@hidden AWBot (Author) : http://awbot.sourceforge.net CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net |
[Prev in Thread] | Current Thread | [Next in Thread] |