|
Posted by Rik Wasmus on 01/06/08 18:40
On Sun, 06 Jan 2008 19:26:30 +0100, A Bit Narked <anonymous@example.com>
wrote:
> Can someone explain the rationale - if there is one - behind
> treating the constants TRUE and FALSE differently?
>
> echo false ;
Will return nothing (empty string) : ''
> echo false+false ;
Will return 0 (cast to integer): '0';
> echo intval(false) ;
Will return 0 (cast to integer): '00';
> echo '"'.false.'"' ;
Will return '""': '00""';
>
> echo true ;
Will return 1: '00""1';
> echo true+true ;
Will return 2: '00""12';
> echo intval(true) ;
Wil return 1: '00""121';
> echo '"'.true.'"' ;
Will return '"1"': '00""121"1"';
> should produce
>
> 000"0"121"1"
No it shouldn't, echo false will not give you a zero. Take a hard look at
the types section in the manual, especially at type juggling.
--
Rik Wasmus
Navigation:
[Reply to this message]
|