PHP 116
Lọc trùng mảng (text ngắt bởi xuống dòng) By Code on 16th August 2019 10:36:22 AM
  1. <?php
  2. $nguon = file_get_contents("text.txt");
  3. if(!$nguon){
  4.         exit();
  5. }else {
  6. set_time_limit(9999999);
  7. $mang = preg_split('/\r\n|\r|\n/', $nguon);
  8. $mang = array_values(array_unique($mang));
  9. $length = count($mang);
  10. for($i = 0; $i < $length; $i++) {
  11.         $person = $mang[$i]."\n";
  12.         $ketqua = 'done.txt';
  13.         file_put_contents($ketqua, $person, FILE_APPEND | LOCK_EX);
  14. };
  15. }
  16.     echo "Done!";
  17. ?>

PasteBin.Win is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.