From: jari at reputation dot fi
Operating system: All
PHP version: 4.3.3RC4
PHP Bug Type: Feature/Change Request
Bug description: array_compact
Description:
------------
Removes all array elements with empty values from a given array.
Didn't manage to find command similar to this.
Reproduce code:
---------------
function array_compact($thisArray) {
for($i = 0; $i < sizeof($thisArray); $i++) {
if($thisArray[$i] != "") {
$newArray[] = $thisArray[$i];
}
}
return $newArray;
}
Expected result:
----------------
Array
(
[0] => banana
[1] =>
[2] => apple
)
->
Array
(
[0] => banana
[1] => apple
)
--
Edit bug report at http://bugs.php.net/?id=25188&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25188&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25188&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25188&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25188&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25188&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25188&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25188&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25188&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25188&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25188&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25188&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25188&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25188&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25188&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25188&r=gnused