Guest User

Untitled

a guest
Aug 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2.  
  3. $csv = fopen('upload/articles_CH_B2C.csv', 'r');
  4.  
  5. $c = 0;
  6.  
  7. while(($content = fgetcsv($csv, 0, '|')) != FALSE) {
  8.  
  9. for($i = 0; $i < count($content); $i++) {
  10.  
  11. $array = explode('=', $content[$i]);
  12.  
  13. foreach($array as $key=>$value) {
  14.  
  15. $items[] = $value;
  16.  
  17. }
  18. }
  19.  
  20. $final = array();
  21.  
  22. for($i = 1; $i <= count($items); $i++) {
  23.  
  24. if($items[$i] != '') {
  25.  
  26. $final[$c][trim($items[$i])] = trim($items[$i+1]);
  27.  
  28. }
  29.  
  30. }
  31. echo $c.' &rarr; '.$final[$c]['secondid'].' - '.$final[$c]['gross_price'].'<br />';
  32.  
  33. $c++;
  34.  
  35. }
  36.  
  37. ?>
Add Comment
Please, Sign In to add comment