#20036 [NEW]: It gets NULL values.. but takes 0 as null too

From: Date: Wed, 23 Oct 2002 09:04:40 +0000
Subject: #20036 [NEW]: It gets NULL values.. but takes 0 as null too
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-23090@lists.php.net to get a copy of this message
From: tanaydin@ihlas.net.tr Operating system: Windows 2000 PHP version: 4.2.3 PHP Bug Type: Arrays related Bug description: It gets NULL values.. but takes 0 as null too 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 bug report at http://bugs.php.net/?id=20036&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20036&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20036&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20036&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20036&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20036&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20036&r=support Expected behavior: http://bugs.php.net/fix.php?id=20036&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20036&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20036&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20036&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20036&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20036&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20036&r=isapi

« previous php.bugs (#23090) next »