ести функция которая витаскивает массив. массив : Код (Text): Array ( [0] => Array ( [imdb_id] => 0111161 [writer] => Array ( ) ) [1] => Array ( [imdb_id] => 0068646 [writer] => Array ( [0] => Array ( [link] => /name/nm0701374/ [id] => 0701374 [name] => Mario Puzo [birthday] => Array ( [country] => USA [state] => New York [city] => New York City [birthday_date] => 1920-10-15 ) [death] => 1999-7-2 ) [1] => Array ( [link] => /name/nm0701374/ [id] => 0701374 [name] => Mario Puzo [birthday] => Array ( [country] => USA [state] => New York [city] => New York City [birthday_date] => 1920-10-15 ) [death] => 1999-7-2 ) [2] => Array ( [link] => fullcredits#writers [id] => [name] => Mehr ansehen ) ) ) [2] => Array ( [imdb_id] => 0071562 [writer] => Array ( [0] => Array ( [link] => /name/nm0000338/ [id] => 0000338 [name] => Francis Ford Coppola ) [1] => Array ( [link] => /name/nm0701374/ [id] => 0701374 [name] => Mario Puzo ) [2] => Array ( [link] => fullcredits#writers [id] => [name] => Mehr ansehen ) ) ) [3] => Array ( [imdb_id] => 0060196 [writer] => Array ( [0] => Array ( [link] => /name/nm0898812/ [id] => 0898812 [name] => Luciano Vincenzoni ) [1] => Array ( [link] => /name/nm0001466/ [id] => 0001466 [name] => Sergio Leone ) [2] => Array ( [link] => fullcredits#writers [id] => [name] => Mehr ansehen ) ) ) [4] => Array ( [imdb_id] => 0110912 [writer] => Array ( ) ) ) помогите написати функцию которая не будит вытаскивать = "Mehr ansehen"
PHP: <?php function new_array($input_array) { foreach($input_array as $key => $writers) { foreach($writers as $writer_id => $writer) { //проверяем, есть ли ключ с именем name if(in_array("name", $writer)) { //если есть, и он равен Mehr ansehen, то удаляем нужный подмассив if($writer['name'] == "Mehr ansehen") { unset($input_array[$key]['writer'][$writer_id]); } } } } //возвращаем модифицированный массив return $input_array; } ?> правда, могу ошибаться, написал навскидку, не проверив