K
K
Kirill Gorelov2016-03-18 21:41:53
PHP
Kirill Gorelov, 2016-03-18 21:41:53

Write an array to a file, in a normal way?

Hello.
Guys. How to write an array to a file?
Array ( [0] => [email protected] [1] => [email protected] )
Read about serialization and anserialization. But a burda is written to the file (

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Ainur Shakirov, 2016-03-19
@Kirill-Gorelov

If a readable list is needed:

$str='';
foreach($massiv as $value)
{
$str.="\n\r".$value; 
}

Well, then you just write $str to a file.
There will be a list of values.

T
ThunderCat, 2016-03-18
@ThunderCat

what does normal look mean to you?
serialize - Generates a storable representation of a variable
json_encode - Returns a JSON representation of the data
for arrays, both are fine.

A
Alexander Aksentiev, 2016-03-18
@Sanasol

var_export

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question