Bitrix Site Manager

TrimArr

bool
TrimArr(
 array &arr
)

The function TrimArr deletes elements with empty values from the specified array. If at least one element is deleted, the function returns true. Otherwise, false is returned.

Parameters

ParameterDescription
arr Array to be processed. This parameters is specified as a reference to the source array.

Example



<?
$ar = array(
  "a" => "1",
  "b" => " ",
  "c" => "",
  "d" => "2"
);
TrimArr($ar);
// array $ar now looks as follows:
//  array("a" => "1", "d" => "2")
?>