ID:               25188
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jari at reputation dot fi
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: All
 PHP Version:      4.3.3RC4
 New Comment:

Wouldn't array_filter() provide what you're looking for? 
 
J 


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

[2003-08-21 08:45:52] jari at reputation dot fi

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

Reply via email to