php - How to put an array into a file? -
i file content array:
$array = file('sample.txt', file_ignore_new_lines); how reverse this? if have array how write file, each value in seperate line.
it not make sense put each value on different row. you're looking serialize.
if want each element on it's own line, use implode:
$str = implode("\n", $array); file_put_contents($file, $str);
Comments
Post a Comment