Bug #15344 Updated: TRUE is 1, FALSE ought to be 0, but is actually NULL;
| From: | yohgaki@php.net | Date: | Sat, 02 Feb 2002 23:58:06 +0000 |
| Subject: | Bug #15344 Updated: TRUE is 1, FALSE ought to be 0, but is actually NULL; | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-78911@lists.php.net to get a copy of this message | ||
ID: 15344
Updated by: yohgaki@php.net
Reported By: uk@uukk.f2s.com
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] uk@uukk.f2s.com
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