What is the best way to parse such files & use variables as well as their values? [closed]

//file1.php
<?php $config['english']['login'] = "login here";
$config['english']['logout'] = "logout";

//file2.php
<?php $anotherVar['english']['varone'] = "Some text in var one";
$anotherVar['english']['vartwo'] = "Some text in var two";

Now, consider a whole bunch of files with data like this. The variables can be anyting!

I need to create similar files for other languages.

I can use eval(), parse the file & explode with “=” etc. but the variable values can be in multiple lines, and some lines could be commented out, etc., which is a big headache if i just parse using file_get_contents or with file

What is the best way to achieve what i want?
I want to list all such variables from a given list of files in “english”
And then, for each file, I want to take the value of each variable in the file and then write out to files in other directories, replacing ‘english’ with ‘german’ in the variable name, for example, ( for ‘german’, i will do an api call to google translate & get the german translated text, for example)

Edited:
What i have tried so far: read file contents with every line into an array, and explode it with ‘=’, and then include the files as well & do an eval() , and get the German text etc. Very ugly way to do it. Am sure that there is a better way.

I have inherited this where for, english, for example, the strings are stored in the examples I have given above. Gettext or storing the strings in a database would have been better, but, sadly, this is what i have!

EDIT2
What I finally want to achieve is to write out to new files like this:

//file1German.php
<?php $config['german']['login'] = "login here (text actually translated to German)";
$config['english']['logout'] = "logout(text actually translated to German)";

//file2German.php
<?php $anotherVar['english']['varone'] = "Some text in var one(text actually translated to German)";
$anotherVar['english']['vartwo'] = "Some text in var two(text actually translated to German)";