0


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 :("; }

1 Answer 1

1

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 :("; 
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.