Normal Play Time parser for PHP (rfc2326)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Podlove/NormalPlayTime
test
.gitignore
.travis.yml
CHANGELOG.md
README.md
composer.json
phpunit.xml

README.md

Normal Play Time Parser

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