Storing Include Result in a Variable in PHP
It is possible to make the result of the included file
storable in a variable. For this,
the included file must return data
via return.
Let's look at an example. Suppose our file returns an array:
<?php
return ['a', 'b', 'c', 'd', 'e'];
?>
Let's include this file and store the result of the inclusion in a variable:
<?php
$arr = require 'arr.php';
var_dump($arr);
?>
Create a file that will return the names of the days of the week. Include it into a variable in your main file.