Convert the duration of a video in seconds with PHP

Hello,

I have a small problem, I would like to convert with PHP the duration of a video in seconds but I can not do it. I want to do this to have more flexibility to display the durations on my website.

Exemple : 3h18m46s in to secondes.

Thank you very mutch

Just take the string, tokenise and parse it.

I could go and actually write the PHP solution, but it’s just string manipulation, do you just want an answer?

Split around non numeric, parse each item in the array and convert to a unix.
Or you could replace non numerics with a : and then pass to strtotime and go from there.

Thats two possibles.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.