Here is a PHP array:
$arr = [
'target_a' => [],
'target_b' => [],
'target_c' => [
'target_d' => [],
'target_e' => [
'target_f' => []
],
],
'target_g' => [],
];
target_a ,target_b, ... , target_n is never duplicated with each other.
I need a function: superFind() , which can do:
superFind('target_e');
// supposed to return:
'target_e' => [
'target_f' => []
],
superFind('target_a');
// supposed to return:
[]
ie, for a given target_x
value,return a subset(better including itself)
I've tried recursively function and https://packagist.org/packages/nicmart/tree , cannot figure out how to solve this.