The object is created to represent the duration of a media file. The duration can then be output in H:i:s format
| Data type | Property | Description |
|---|---|---|
| int | duration | The duration in milliseconds |
| Visibility | Function (parameters,...): return |
|---|---|
| public | __construct(int $duration): void |
| public | minutes(): string The duration represented in minutes |
| public | seconds(): string The duration represented in seconds |
| public | __toString(): string Auto convert the object to a string and output in H:i:s format |
|
$dur = new Duration(20152000);
print $dur->seconds().PHP_EOL; // 20152
print $dur->minutes().PHP_EOL; // 335
print (string) $dur; // 05:35:52