Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $file = fopen('myfile.csv', 'r');
- $fields = array();
- if ($file) {
- while (($data = fgetcsv($file)) !== false) {
- if(empty($fields)) {
- $fields = $data;
- continue;
- }
- $row = array_combine($fields, $data);
- $output = sprintf("%s - %s - %u <br />n",
- $row['make'],
- $row['model'],
- $row['serial']);
- echo $output;
- }
- fclose($file);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement