PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
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 Clear