#20036 [Opn->Bgs]: It gets NULL values.. but takes 0 as null too
| From: | hholzgra@php.net | Date: | Wed, 23 Oct 2002 09:52:53 +0000 |
| Subject: | #20036 [Opn->Bgs]: It gets NULL values.. but takes 0 as null too | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-23091@lists.php.net to get a copy of this message | ||
ID: 20036
Updated by: hholzgra@php.net
Reported By: tanaydin@ihlas.net.tr
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Windows 2000
PHP Version: 4.2.3
New Comment:
Thank you for taking the time to write to us, but 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
see
http://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting
Previous Comments:
------------------------------------------------------------------------
[2002-10-23 04:04:40] tanaydin@ihlas.net.tr
I wrote a function like that
function rm_empty_values($array) {
$x = 0;
foreach ($array as $key => $value) {
if($value) {
$array_temp[$x] = $value;
$x++;
}
}
return $array_temp;
}
$hede = array("hede", "hodo", "0", 1);
$list = rm_empty_values($hede);
print_r($list);
but it removes $hede[2] (0 value) too and i modified my function to
function rm_empty_values($array) {
$x = 0;
foreach ($array as $key => $value) {
if(($value) || ($value == "0")) {
$array_temp[$x] = $value;
$x++;
}
}
return $array_temp;
}
and it works.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20036&edit=1