Hello,
In this array : https://pastebin.com/8nGbPx0P
I want to check if the key "iso_639_1" is equal to "fr"and if yes, then I look for the value of the key "name" and if "iso_639_1" has no value "fr", then I want to go through the Array again looking for a key wtih valor "en", etc.
But I don't know how to do it.
If have try with if / else, but he stop when he find a good valor, he don't only check for FR valor, and if not exist, retry.
This is my code :
<?php
function bandeAnnonce($videos)
{
foreach($videos->results as $key => $v)
{
if($v->iso_639_1 == 'fr')
{
if(preg_match('#bande|trailer#is', $v->name))
return (string) is_youtubeId($v->key);
}
else
{
if(preg_match('#bande|trailer#is', $v->name))
{
echo $v->key;
return (string) is_youtubeId($v->key);
}
}
}
return null;
}
Do you have an idea?