Im working on a way to check if a array contains a value, if not dont run inner code. As the example below there are a couple of languages, but in this case the 'en' language is not present, so if the current translation is 'en' and the 'en' language is not present in the array dont run the second foreach. Using the in_array does not seem to work, if there a function to check if the the valeu is present in the childeren of an array?
the array
$arr =array(
[16] => Array
(
[0] => Array
(
[language] => de
[translation] => blog/beer
)
[2] => Array
(
[language] => es
[translation] =>
)
[3] => Array
(
[language] => fr
[translation] => blog/paris-big-city
)
[4] => Array
(
[language] => it
[translation] => blog/it-slug
)
[5] => Array
(
[language] => nl
[translation] => blog/nederlands-slug
)
)
[...]//more
)
the loop
foreach($arr as $items){
//we need to check if current language is present
if( in_array('en' , $items) ){
foreach($items as $item){
// run code when certain language is present
}
}
}