I have a small issue. Is there (in PHP) any way to update array in the php file? For example I have file with this code
$array = array(
'test' => 'aaaa'
'test2' => 'aaaa'
'test3' => 'aaaa'
etc etc, more data
);
I load this array via include file.php using $array, I do some stuff and pick just few keys I need to delete (they are unused, ...). Is there any way how to do it nicely? I mean I could delete file and fwrite first line, then use foreach for every key and at the end write ); to file. But there is a problem. The file does not include just this array (There are multiple variables, texts,...).
So could anyone help me? Please dont ask me why its done this way, Im not happy about it either, I just need to solve this.
Summary: I have the array keys i want to delete in array + I have array in .php file I need to modify nicely
If you really want to store your data as php array, instead of some database then you should use: serialize() and unserialize()
Then your workflow will look like: