Advertisement
szabozoltan69

step3.php

Aug 2nd, 2017
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. #!/usr/bin/php
  2. <?php
  3. fclose(STDOUT); $STDOUT = fopen('F1.csv', 'w');
  4.  
  5. define('d',";");
  6. define('n',"\n");
  7.  
  8. $f_=file('F1_.csv',FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
  9.  
  10. $szurj=array();
  11. foreach($f_ as $i=>$f){
  12.         if ($i==0) continue;
  13.         $x=explode(d,$f);
  14.         if ( empty($szurj[$x[0].d.$x[3].d.$x[6].d.$x[8]]))      $szurj[$x[0].d.$x[3].d.$x[6].d.$x[8]]=$x[7];
  15.         else { if ($szurj[$x[0].d.$x[3].d.$x[6].d.$x[8]]<$x[7]) $szurj[$x[0].d.$x[3].d.$x[6].d.$x[8]]=$x[7];}
  16. }
  17.  
  18. foreach($f_ as $i=>$f){
  19.         if ($i==0) {print $f.n; continue;}
  20.         $x=explode(d,$f);
  21.         if (empty($szurj[$x[0].d.$x[3].d.$x[6].d.$x[8]])) continue;
  22.         if ($szurj[$x[0].d.$x[3].d.$x[6].d.$x[8]]!=$x[7]) continue;
  23.         print implode(d,$x).n;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement