Reputation: 83
I use tmdb_v3.php api with this code:
$movietrailer = $tmdb_V3->movieTrailer($idMovie);
In "pre" query I got this:
Array
(
[id] => 49017
[quicktime] => Array
(
)
[youtube] => Array
(
)
)
I need an [php iffset]. If [youtube] contain value, echo "We have trailer". If no, echo "No trailer yet :(". I tried this but don't working:
if(isset($movietrailer['youtube']))
{ echo "We have trailer"; } else { echo "No trailer yet :("; }
Upvotes: 0
Views: 1154
Reputation: 219804
That value is always set. It just doesn't always have a value. Use empty()
see if it has a value:
if(!empty($movietrailer['youtube'])) {
echo "We have trailer";
} else {
echo "No trailer yet :(";
}
Upvotes: 1