It looks like you are changing the file name, not the contents.
Do
$reverse = array_reverse($content); // you can drop 2nd arg. $string = implode("<br>" , $reverse);
instead
$reverse = array_reverse($file, true); $string = implode("<br>" , $contents);
You can also remove temporary variables from the script and do:
foreach (glob("*.txt") as $filename) { echo implode("<br>" , array_reverse(file($filename))) . "<br></br>"; }
source share