From:             [EMAIL PROTECTED]
Operating system: SuSE Linux 7.3
PHP version:      4.0.6
PHP Bug Type:     Unknown/Other Function
Bug description:  TRUE is 1, FALSE ought to be 0, but is actually NULL;

TRUE is represented as 1, 
FALSE or (boolean)0 ought to be represented as 0, but is 
actually NULL;

This results in numerous side-effects 
such as HTML-tables partially shown, etc ...

<?

        //
        // L206.php
        // 
 
        include("ukFnctLib.php");

        //==================================
        //sample data
        for($no=0;$no<5;$no++)
        { 
                $arrContact[$no]=
                array
                ( 
                        "surname"                       
        =>"surname".$no, 
                        "christianName" 
=>"christianName".$no, 
                        "address"                       
        =>"address".$no, 
                        "country"                       
        =>"country".$no, 
                        "postcode"                      
=>"postcode".$no, 
                        "town"                          
        =>"town".$no, 
                        "phone"                         
        =>"phone".$no, 
                        "fax"                           
                =>"fax".$no, 
                        "email"                         
        =>"email".$no,
                        "age"                           
                =>20+$no,
                        "height"                        
        =>1+$no/10,
                        "nice2"                         
        =>(($no%2)==0?"TRUE":"FALSE"), 
                        "nice1"                         
        =>(($no%2)==0?TRUE:(boolean)NULL) 
                )
                ; 
        }//for
 
        //==================================
        //the author's way: foreach
        foreach($arrContact as $arrContactKey=>$arrAddress)
        { 
                foreach($arrAddress as 
$arrAddressKey=>$arrAddressData)
                { 
                        echo $arrContactKey,": 
",$arrAddressKey,": ",$arrAddressData,"<br>"; 
                }//foreach 
                echo "<br>"; 
        }//foreach 

        //==================================
        //uk's way
        ukPrintTable($arrContact);
 
?>

include:

function ukPrintTable($array)
{
        //new table
        echo"<table border=1>";

        //table header
        echo"<th>array key</th>";
        echo"<th>array data type</th>";
        echo"<th>array value</th>"; 

        //table rows
        do
        {
                echo"<tr>";
                echo"<td>",key($array),"</td>";
 
                echo"<td>";
                echo gettype(current($array));
                echo"</td>";

                echo"<td>";
                if(gettype(current($array))=="array")
                        ukPrintTable(current($array));
                else
                        echo current($array);
                echo"</td>";

                echo"</tr>";
        }while(next($array));

        //end of table
        echo "</table>";
}//uk_print_table 


-- 
Edit bug report at: http://bugs.php.net/?id=15344&edit=1
Fixed in CVS: http://bugs.php.net/fix.php?id=15344&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15344&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15344&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15344&r=oldversion
Not for support: http://bugs.php.net/fix.php?id=15344&r=support
Not wrong behavior: http://bugs.php.net/fix.php?id=15344&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15344&r=notenoughinfo


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to