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

Popular posts from this blog

sql - text truncated using perl DBI insert -

c++ - Is it possible to compile a VST on linux? -

php - Pass object by reference or value -