So I have an multidimensional Array that looks like this:
Array
(
[0] => Array
(
[0] => Date
[1] => Time
[2] => Duration
[3] => Info
[4] => Client
)
[1] => Array
(
[0] => 2021-12-01
[1] => 10:45:43
[2] => 237
[3] => Test none
[4] => Client 1
)
[2] => Array
(
[0] => 2021-12-01
[1] => 11:29:13
[2] => 77
[3] => Test important
[4] => Client 2
)
[3] => Array
(
[0] => 2021-12-01
[1] => 11:53:03
[2] => 44
[3] => Info
[4] => Client 1
)
and what I need is to count by the values in the sub array. An example, I am using the array_walk_recursive function like this:
array_walk_recursive($dataArray, function ($i) use (&$countRes) {
$countRes += (int) ($i === 'Info');
});
And the Output for this is correct i get the number 2. Thats perfect. But what I need now is to count the sub_arrays with the "Test" value. The problem is that in the Text there is always something different after the "Test" value like, "Test none" or "Test important". Regardless of what is after the text "test" how can I still count them?
I have tried with some wildcard symbols but it is not working. Any suggestions how to do it?
array_walk_recursive($dataArray, function ($i) use (&$countReUb) {
$countReUb += (int) ($i === 'Test*');
$countReUb += (int) ($i === 'Test.*');
$countReUb += (int) ($i === 'Test%');
});
None of them are working.