Ошибка при переходе с php 5.6 на php 7

При переходе с php 5.6 на php 7 не получается справится с проблемой:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; changelog has a deprecated constructor in путь\file.php(57) : eval()'d code on line 3

50 $module = scandir($location);
51   foreach($module as $value)
52   {
53     if ($value != "." && $value != ".." && $value != "index.php")
54     {
55       $mod_key = str_replace(".php", "", $value);
56         $mod_f = file_get_contents("$location/$value/index.php");
57           $mod_file[$mod_key] = eval("?>".$mod_f);
58     }
59   }
60
61  $data = array(
//...
74  "module" => $mod_file,
//...
137 );

Почему ругается на eval(), и на что можно заменить?

Все:

class view_cart
{
  function view_cart()

заменил на:

class view_cart
{
  function __construct()

Ответы (1 шт):

Автор решения: Олег

Извиняюсь, проблему решил. Невнимательно прочитал текст предупреждения и не увидел changelog. Также заменил её на __construct.

→ Ссылка