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
)
You create StdClass objects and access methods from them like so: $obj = new StdClass; $obj->foo = "bar"; echo $obj->foo; I recommend subclassing StdClass or creating your own generic class so you can provide your own methods. Thank you for your help!
The stdClass is the empty class in PHP which is used to cast other types to object. It is similar to Java or Python object. The stdClass is not the base class of the objects. If an object is converted to object, it is not modified.
Within class methods non-static properties may be accessed by using -> (Object Operator): $this->property (where property is the name of the property). Static properties are accessed by using the :: (Double Colon): self::$property .
You could do:
echo $yourObject->duration;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With