I want to get the first line of my Foo.csv as an array.
Foo.csv:
I, Like, Chocolate
And, Also, Milk
I tried
//$foo is Foo.csv
$file = fopen($foo, "r")
//First attempt
$fgetsFile = fgets($file)
//Other way
$streamlineFile = stream_get_line($file, 10000, "\n");
fclose($file)
var_dump($fgetsFile) // (String) "I", "Like", "Chocolate"
var_dump($streamlineFile) // (array) [0] => (string) "I", "Like", "Chocolate"
I would like to end up with an array like this:
array([0] => "I", [1] => "Like", [2] => "Chocolate)