Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
7577c035
Commit
7577c035
authored
Jan 27, 2016
by
Carsten Rose
Browse files
OnArray: created new funtction filter on arrays
parent
19d36d65
Changes
1
Hide whitespace changes
Inline
Side-by-side
qfq/helper/OnArray.php
View file @
7577c035
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment