shgysk8zer0 / core_api

The foundation of Core. Only traits, interfaces, & abstracts
GNU General Public License v3.0
0 stars 1 forks source link

Generic parser #6

Closed shgysk8zer0 closed 9 years ago

shgysk8zer0 commented 9 years ago

Should be able to parse INI, JSON, & XML files. Try to have the results be as similar as possible (may require a lot of work when it comes to XML).

shgysk8zer0 commented 9 years ago

Since this is meant to be a generic parser and CSV is a common form of storing data, I'll use this to remind myself of a method of reading/writing CSV.

$handle = fopen('test.csv', 'r');
$csv = [];
while ($row = fgetcsv($handle)) {
    $csv[] = $row;
}
fclose($handle);
$handle = fopen('out.csv', 'a+');
foreach($csv as $row) {
    fputcsv($handle, $row);
}
fclose($handle);

Really wish that I had the fgetcsv function earlier... Would have saved me a whole lot of trouble.

shgysk8zer0 commented 9 years ago

Resolved in commit f8ea3801d8c68c6080b4f2c22a6e068faa1e5c1f