If you plan to reuse the same values inside an array, you can use var_exportan array to create this file.
Basic example:
$arr = array('name','rollno','address');
file_put_contents('array.txt', '<?php return ' . var_export($arr, true) . ';');
Then, when it comes time to use these values, just use include:
$my_arr = include 'array.txt';
echo $my_arr[0];
Or just use a simple string JSON, then encode / decode:
$arr = array('name','rollno','address');
file_put_contents('array.txt', json_encode($arr));
, :
$my_arr = json_decode(file_get_contents('array.txt'), true);
echo $my_arr[1];