Question

i want to get the length of a MP3-File in PHP. The code i´ve found by google is from getID3, but it dosen't works.

I always get the following errormessage and i´dont know how i can fix it.

PHP Parse error: syntax error, unexpected T_ECHO in /.../getDuration.php on line 17

My PHP-Code:

<?php

$include = dirname(__FILE__). '/';

include_once $include . 'getid3.php';
include_once $include . 'getid3.lib.php';
include_once $include . 'module.audio.mp3.php';
include_once $include . 'module.tag.apetag.php';
include_once $include . 'module.tag.id3v1.php';
include_once $include . 'module.tag.id3v2.php';


$pathName = '/var/..../audio/audio.mp3';

$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($pathName)
echo $ThisFileInfo['playtime_string'];

?>
Was it helpful?

Solution

You missed a semicolon at the end of this line

$ThisFileInfo = $getID3->analyze($pathName);
                                         //^------ Add one here 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top