I'm building something in PHP which reads from a PHP file, which looks like this:
<?php
return [
'name' => 'John Smith'
];
In my code, I'm getting the contents of the file and I'm reading it. But here's my problem. When I want to add an item to that array, I can but I'm not sure how to save it back into that array file.
I've tried these ways of doing it ($array being the updated array)
file_put_contents('file.php', var_export($array, true));
file_put_contents('file.php', print_r($array, true));
return_r()when it is at home with its boots off?var_export($array, true)actually gives you, then figure out which missing parts around it you have to add yourself.