How to refer a variable from another file?

Just saying I'm inadequate %) in their knowledge of php.
I have a file index.php there is variable.
$company_email = $this->params->get('company_email');

I also have the file send.php where is the variable $address.
How can I do to make $address take the value from the variable $company_email from a file index.php.
Perhaps the question entirely out of the realm of moronity)
July 9th 19 at 12:56
1 answer
July 9th 19 at 12:58
Variants a little:
1. to do 1 the include file above another
2. To pass a GET parameter
3. In index.php record $company_email in a. txt file and send.php read from this file
If the files are not in any way related, I would chose the 3rd option as the most simple but reliable
Will prompt 3 options in detail? Yes, to me it is more like it. Where to dig? - caleb_Stehr commented on July 9th 19 at 13:01
// Read
 $file_id = file_get_contents('folder/text.txt', true);

// Write
 $filename = 'folder/text.txt';
 if (is_writable($filename)) {

 if (!$handle = fopen($filename, 'w+')) { 
 echo "cannot open file ($filename)<br>";
 // Writable $company_email in our public file.
 if (fwrite($handle, $company_email) === FALSE) {
 echo "Successfully written to file ($filename)<br>";
 } else {
 echo "File is not writable<br>";
- alva8 commented on July 9th 19 at 13:04
: Thank you. - caleb_Stehr commented on July 9th 19 at 13:07

Find more questions by tags PHP