Created
February 1, 2013 20:02
-
-
Save objectivehtml/4693712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * csv parser | |
| * | |
| * reads csv data and transforms it into php-data | |
| * | |
| * @access protected | |
| * @return boolean | |
| */ | |
| protected function parse() | |
| { | |
| if (!$this->validates()) { | |
| return false; | |
| } | |
| $c = 0; | |
| $d = $this->settings['delimiter']; | |
| $e = $this->settings['escape']; | |
| $l = $this->settings['length']; | |
| $res = fopen($this->_filename, 'r'); | |
| while ($keys = fgetcsv($res, $l, $d, $e)) { | |
| if ($c == 0) { | |
| $this->headers = $keys; | |
| } else { | |
| array_push($this->rows, $keys); | |
| } | |
| $c ++; | |
| } | |
| fclose($res); | |
| $this->removeEmpty(); | |
| return true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment