PHP code example of delphiki / subrip-file-parser
1. Go to this page and download the library: Download delphiki/subrip-file-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
delphiki / subrip-file-parser example snippets
sh
php composer update
php
e = new \SrtParser\srtFile('./subtitles.srt');
// display the text of the first entry
echo $file->getSub(0)->getText();
// merge 2 files and save the new generated file
$file2 = new srtFile('./subtitles2.srt');
$file->mergeSrtFile($file2);
$file->build();
$file->save('./new_subtitles.srt');
}
catch(Exception $e){
echo 'Error: '.$e->getMessage()."\n";
}