What are the advantages and disadvantages of using file_put_contents() and var_export() to store and retrieve arrays in PHP compared to other methods?

When storing and retrieving arrays in PHP, using file_put_contents() and var_export() can be advantageous because they provide a simple way to serialize and deserialize arrays to and from files. This can be useful for storing configuration data or caching information. However, these methods may not be the most efficient for large arrays or sensitive data, as they write/read the entire array to/from a file each time.

// Storing an array using file_put_contents() and var_export()
$data = ['apple', 'banana', 'cherry'];
file_put_contents('data.txt', '<?php return ' . var_export($data, true) . ';');

// Retrieving the array from the file
$data = include 'data.txt';
print_r($data);