Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. $file = fopen('myfile.csv', 'r');
  2. $fields = array();
  3.  
  4. if ($file) {
  5. while (($data = fgetcsv($file)) !== false) {
  6. if(empty($fields)) {
  7. $fields = $data;
  8. continue;
  9. }
  10.  
  11. $row = array_combine($fields, $data);
  12.  
  13. $output = sprintf("%s - %s - %u <br />n",
  14. $row['make'],
  15. $row['model'],
  16. $row['serial']);
  17.  
  18. echo $output;
  19. }
  20. fclose($file);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement