Is there way to append data to file on specific line or something similar like that?
I have an "handmade" array in my file, and I need to keep my beginning and end of the array.
I would like to have something like this:
$array = [
*create new line and write data here*,
*previous data*,
*previous data*,
*previous data*,
];
EDIT: I currently only know how to append data at the end of the file, and I haven't found proper solution. If I append my data with just file_put_contents();
, it won't be in the array:
$array = [
*previous data*,
*previous data*,
*previous data*,
];
*create new line and write data here*,
EDIT: I got my answer. There is no efficient way to do this.