PHPize Online / SQLize Online

A A A
Share   Donate   Blog   Popular
Copy Format Clear
Copy
Copy Format Clear
<?php private function readCSV(): Generator { $handle = fopen($this->filePath, "r"); if ($handle === false) { throw new ErrorException('Unable to open the file.'); } $header = fgetcsv($handle, 0, $this->delimiter); while (($data = fgetcsv($handle, 0, $this->delimiter)) != false) { yield array_combine($header, $data); } fclose($handle); }
Show:  
Copy