<?php $file = file_get_contents('test.txt'); $arr = array_unique(explode(PHP_EOL, $file)); foreach($arr as $arrVal){ echo $arrVal.'<br>'; } ?>
test1 test2 test7 test2 test2 test3 test3 test9