Export preg_match_all matches to csv file

aizee

New Member
I'm trying to export matches from preg_match_all to a csv file but am getting the following error:\[code\]Warning: fputcsv() expects parameter 2 to be array, string given\[/code\]This is the section of code I'm having issues with, how can I modify it so I am able to export the matches to a csv file?\[code\]preg_match_all($pattern, $pos, $matches);$fp = fopen('data.csv', 'w');foreach($matches[0] as $data){ fputcsv($fp,$data);}fclose($fp);\[/code\]
 
Back
Top