Variable $total is an array().
print_r($total) gives:
Array (
[01] => Array ( [title] => text [date] => date )
[02] => Array ( [title] => text [date] => date )
[03] => Array ( [title] => text [date] => date )
)
How to write this array to file.txt?
And how to call created file later, so I can work with array inside it? Like:
$extracred_array = file.txt;
echo $extracred_array[1][title];
Thanks.
You need to serialize it with
serializefunction like this:Now you can save the
$serialize_arrayin your file. To read it back and convert to array again, use theunserializefunction.Update:
To read the file back: