I have a Laravel project and have JSON file and want to search in the 3rd level of an array and return of level 1 of array in date array range this array I want to search
I use this function:
public function search3($array, $key, $value){
$results = array();
if (is_array($array)) {
if (isset($array[$key]) && $array[$key] == $value) {
$results[] = $array;
}
foreach ($array as $subarray) {
$results = array_merge($results, self::search3($subarray, $key, $value));
}
}
return $results;
}
and return with results but not give me this array enter image description here
I want function return where is parent of parent of this array:
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire