I have /fonts/ folder full of .js files.
I know how to read this folder and list all the files there:
$dir = "/fonts"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo '<tr><td>'. $file .'</td></tr>'; } closedir($dh); } }
But I don't want to write filenames but data they store.
The pattern inside looks like this:
NameOfTheFontFile_400_font.js:
(...) "font-family":"NameOfTheFont" (...)
So how to modify my first script to open-read each file and grab the font-family name instead of file name?
Thanks a lot!