PHP - SPL file object returning null on seek -
alright, using spl file object a+ mode. data apends correctly want validate last row of data grabbing file again. data csv format, works first line in file , apends 2 line correctly. when seeking 2nd line returns null.
<?php $handle = new splfileobject("filepath here","a+"); $handle->setflags(splfileobject::read_csv); // write using fputcsv $status = $handle->fputcsv($data,','); $status = $handle->fputcsv($data,','); $handle->seek(1); $fields = $handle->fgetcsv(','); $fields2 = $handle->current();
// both fields , fields2 return null
there 2 lines worth of data in file. please help
Comments
Post a Comment