I have created this small script in order to parse a cvs file and then pass it on to mysql. I need to do quite some editing to it but I just started with editing the format of the date according to the http://csv.thephpleague.com manual.
<?php
if (!ini_get("auto_detect_line_endings")) {
ini_set("auto_detect_line_endings", '1');
}
use League\Csv\Reader;
$reality = Reader::createFromPath('Workbook3.csv');
$planed = Reader::createFromPath('Workbook4.csv');
/*this function removes the "First name" "Second name" elements and
creates one that actually has the entier name in capital*/
$functionHRT = function ($row) {
$row['hrtData'] => DateTimeImmutable::createFromFormat($row['Contract Start'], 'd-m-Y'); /*this is line 18*/
}
$hrtData = $reality
// ->setOffset(7);
->fetchAssoc( , $functionHRT());
$hrtData[0]['Contract Start']->format('Y-m-d');
?>
When I try to run this I get an:
Parse error: parse error in /Users/nefeli/Code/ph/script.php on line 18
error code. I am not sure what the problem syntax error is. Any insight on this?