Commit 7577c035 authored by Carsten  Rose's avatar Carsten Rose
Browse files

OnArray: created new funtction filter on arrays

parent 19d36d65
......@@ -67,4 +67,23 @@ class OnArray {
}
return $arr;
}
/**
* Iterates over all records and return those with $row[$column]==$value
*
* @param array $dataArray
* @param $column
* @param $value
* @return array
*/
public static function filter(array $dataArray, $column, $value) {
$result = array();
foreach ($dataArray as $row) {
if (isset($row[$column]) && $row[$column] == $value) {
$result[] = $row;
}
}
return $result;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment