What is the best way to save a multi-dimensional array in a readable format in a file using PHP?

When saving a multi-dimensional array in a file using PHP, the best way is to serialize the array before writing it to the file. This ensures that the array is stored in a compact and readable format. To save the array, you can use the `serialize()` function to convert the array into a string, and then write this string to a file using file handling functions.

// Sample multi-dimensional array
$array = array(
    array('John', 'Doe'),
    array('Jane', 'Smith')
);

// Serialize the array
$serializedArray = serialize($array);

// Write the serialized array to a file
$file = 'array_data.txt';
file_put_contents($file, $serializedArray);