array_filter
brefphp/bref
Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Filters elements of an array using a callback function
array_filter
(array
$array
, ?callable
$callback
=
null
,
int $mode
=
0
): array
):
void
{
$logLines
=
explode
(
"\n"
,
$logs
);
$logLines
=
array_filter
(
$logLines
, function (
string $line
):
bool
{
$line
=
trim
(
$line
);
return
$line
!==
''
&& (
strpos
(
$line
,
'START'
) !==
0
)
&& (
strpos
(
$line
,
'END'
) !==
0
)
&& (
strpos
(
$line
,
'REPORT'
) !==
0
);
});
$this
->
assertCount
(
1
,
$logLines
);
$logLine
=
reset
(
$logLines
);
tests/Sam/PhpRuntimeTest.php