I am having a trouble with my code. My goal is to write a data in txt file and retrieve that data.
In writing data I used an array. And I added the FILE\_APPEND parameter for rewriting the text file.
After I write the data into the text file I serialize it first. Then after writing the data I retrieve it using file\_get\_contents. I unserialize this also to display in array form. 

Now my problem is. If I add new data the textfile will be overwrite but in displaying my data into array. It will always get the first index the index '0'. I can't get all the serialized array.

Here's my code:

```
$data_add = array(

                array(
                    'restaurant_id' => $restaurant_id,
                    'new_lat' => $new_lat_entry,
                    'new_long' => $new_long_entry,
                    'date_updated' => date('Y-m-d H:i:s')
                )

            );

            $serialize_data = serialize($data_add);
            file_put_contents("test.txt", $serialize_data, FILE_APPEND | LOCK_EX); //write the text file

...

$array = unserialize(file_get_contents('test.txt'));

print_r($array); //display it

```

My sample .txt file

```
a:1:{i:0;a:4:{s:13:"restaurant_id";s:4:"1212";s:7:"new_lat";s:8:"14.69327";s:8:"new_long";s:9:"120.96785";s:12:"date_updated";s:19:"2013-11-14 08:34:50";}}
a:1:{i:0;a:4:{s:13:"restaurant_id";s:4:"1229";s:7:"new_lat";s:8:"14.61431";s:8:"new_long";s:9:"120.99054";s:12:"date_updated";s:19:"2013-11-14 08:35:10";}}

```

But what I got in the array is:

```
Array
(
    [0] => Array
        (
            [restaurant_id] => 1212
            [new_lat] => 14.69327
            [new_long] => 120.96785
            [date_updated] => 2013-11-14 08:34:50
        )

)

```

How can I retrieve all the values from my array?