On Mon, 2002-02-04 at 03:41, Martin Jansen wrote:
> Taking the following script:
> 
> <?php
> $array = array("foo" => true,
>                "bar" => false
>                );
>                
> print_r($array);
> ?>
> 
> The result of print_r is:
> 
>       Array ( [foo] => 1 [bar] => ) 
> 
> Shouldn't false in the array definition result to 0 instead of
> nothing?
> 
> - Martin

No--the string representation of boolean false is ''. You could,
I suppose, force the conversion to int in the assignment:

<?php
$array = array("foo" => true,
               "bar" => (int)false);
               
print_r($array);
?>


Torben

> -- 
>   Martin Jansen, <[EMAIL PROTECTED]>
>   http://www.martin-jansen.de/

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to