21

I work with mp4 data extract php script. this returns a stdClass Object as below. can anyone tell me how to show the duration from below object. thank you

stdClass Object
(
    [hasVideo] => 1
    [hasAudio] => 1
    [video] => stdClass Object
        (
            [width] => 472
            [height] => 360
            [codec] => 224
            [codecStr] => H.264
        )

    [audio] => stdClass Object
        (
            [codec] => 224
            [codecStr] => AAC
        )

    [duration] => 622.8
)

1 Answer 1

46

You could do:

echo $yourObject->duration;
Sign up to request clarification or add additional context in comments.

3 Comments

How to if the stdClass Object has numbers in keys insted of string? @Blaster
@ram Open a Question?
For an object with hyphens or numbers you could do $yourObject->{'duration-123'}

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.