Guest User

Untitled

a guest
Apr 23rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php
  2.  
  3. $f1 = file('file1.txt');
  4. $f2 = file('file2.txt');
  5. $new_data = array();
  6.  
  7. foreach ($f2 as $entry) {
  8.     $data = explode(':', $entry);
  9.     if (!in_array($data[0], $f1) {
  10.         $new_data[] = $entry;
  11.     }
  12. }
  13.  
  14. $f3 = fopen('file2.txt', 'w+');
  15. fwrite($f3, implode(PHP_EOL, $new_data);
  16. fclose($f3);
Add Comment
Please, Sign In to add comment