Re: Overwrite value of true or false in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 7, 2009 at 3:14 PM, Bobby Pejman<bpejman@xxxxxxxxx> wrote:
> Hi,
>
> I noticed that the following returns a 1.
>
> echo (1<2) ? True : False
>
> I was under the impression that true/false are of type boolean and not int.  But in php anything other than 0 translates to true, meaning a 1.  What I am trying to achieve is for a 1 to be a 1 and a true or false to be a true and false respectively and I do not want to put quotes around the word true/false either because then it is no longer a boolean but string.
>
> Is it possible to overwrite php's true/false and declare them as boolean?  You often see in C++, some use Define().
>
> Thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

It might be pertinent for you to read the section of the manual
dealing with type juggling:
http://us3.php.net/manual/en/language.types.type-juggling.php and the
various things linked therein.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux