Temporary-Failure
Temporary-Failure

Reputation: 7

PHP array, print values in file one below another

file_put_contents($file, array_values($delivery[0]), FILE_APPEND);

That prints to file all values in the same row. How to print all values their own line?

Upvotes: 0

Views: 107

Answers (1)

Mitya
Mitya

Reputation: 34556

You need to implode the values into a string, separated by (in your case) a new line.

file_put_contents(
    $file,
    implode("\n", array_values($delivery[0])),
    FILE_APPEND
);

Upvotes: 2

Related Questions