podlove/normalplaytime

PHP parser for Normal Play Time (RFC 2326)

v1.0.3 2013-06-24 11:45 UTC

This package is auto-updated.

Last update: 2024-11-27 04:20:57 UTC


README

Build Status

PHP parser for Normal Play Time (RFC 2326)

Usage

<?php
use \Podlove\NormalPlayTime\Parser;

// get seconds or milliseconds
Parser::parse("1.834");      // 1834
Parser::parse("1.834", "s"); // 1

// invalid returns NULL
Parser::parse("abc"); // NULL

// valid example NPT strings
Parser::parse("1");        // 1000
Parser::parse("12:34");    // 754000
Parser::parse("12:34.56"); // 754560
Parser::parse("1:2");      // 62000
Parser::parse("1:2:3.4");  // 3723400