I have two arrays and both of them are sorted by the 'hostid'. Now I'm filtering the first array with the values, so I can get every value that is less than 10. The values that are more than 10 are now out of the array. Now I want to do exactly the same with the second array because I need only the Names with the same 'hostid' like the filtered array. But the second array has only names and I do not know how to filter that it has also only the items with the same 'hostid' as the filtered array.
So this are the two arrays:
Array 1: $filtered = array_filter($names1, function ($x) { return $x <= 15; });
Output: {"0":"8.4112","2":"9.5231","3":"9.0655","4":"7.8400","5":"13.2712","6":"12.2458","9":"8.1954","13":"12.8633"}
Array 2: $nameserver = array();
Output: ('["name1","name2",... ]')
Is there a way to filter the same hostids from the second array as I did from the first? I already tried to combine them, but that did not work.