ID: 15344
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Unknown/Other Function
Operating System: SuSE Linux 7.3
PHP Version: 4.0.6
New Comment:

This is not a bug. Please double-check the documentation available
at http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


Previous Comments:
------------------------------------------------------------------------

[2002-02-02 15:49:51] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=15344&edit=1


-- 
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