0

I'm trying to get a specific link for each of my videos from the Vimeo API. I can loop through the results and echo them in a foreach but when I try to access a specific value it still out puts all the results:

    // Make Request
    $response = $lib->request('/videos/'.$vurl.'?fields=files', [ ], 'GET');

    // Get Response
    $links = $response['body']['files'];

    foreach ($links as $key => $value) {

        if ($value['width'] = '1920') {

            echo $value['link_secure'];

        } else {

            echo 'no match';

        }
    }

How do I access just the result where the $value equals '1920'?

1 Answer 1

2

use == instead of = here.

 if ($value['width'] == 1920) {

        echo $value['link_secure'];

    } else {

        echo 'no match';

    }
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.