| 
 Posted by ImOk on 07/11/06 12:53 
Why are you complicating your life. Just do the following 
 
print (int) false;  // prints 0 
print (int) true;  // prints 1 
 
 
Greg Scharlemann wrote: 
> I'm having an issue passing a boolean to the constructor of an object. 
> For some reason, if I pass false into the constructor, it doesn't 
> register.  If I pass an integer 0, it does.  PHP 5 Code below: 
> 
> --------------------- 
> class Test { 
>     var $testBool; 
> 
>     public function __construct($testBool) { 
>         print "testBool = $testBool"; 
>     } 
> } 
> 
> $testing = new Test(false);  // this just prints "testBool = " 
> 
> $testing = new Test(0);       // this prints "testBool = 0" 
> 
> -------------------- 
> Seems to be both methods should print 0 or false.  What have I missed?
 
  
Navigation:
[Reply to this message] 
 |