Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************** READCSV ********************** START */
- $sbkfile = fopen($_SERVER['DOCUMENT_ROOT'] . '/includes/sbk.php', 'r'); // fopen csv file
- $header = fgetcsv($sbkfile); // get the first (header) line
- $data = array(); // get the rest of the rows
- while ($row = fgetcsv($sbkfile)) { // while loop for file
- $arr = array(); // setting array variable
- foreach ($header as $i => $col) // foreach loop about columns
- $arr[$col] = $row[$i]; // setting things straight
- $data[] = $arr; // setting $data variable from array
- array_unshift($data,""); // shift array from base 0 to base 1
- unset($data[0]); // unsetting array level 0 which now is lifted to 1
- }
- /********************** READCSV ********************** END */
Advertisement
Add Comment
Please, Sign In to add comment