public function GetL( $data ) {
$path = INCLUDE_DIR . '/Settings/' . $data . '.php';
if ( file_exists( $path ) ) {
include_once $path;
return $$data;
} else {
return 'Error while connecting the settings file: ' . $data;
}
}
var_dump( $Settings->GetL('settings') );
$this->Settings->GetL('settings');
Notice: Undefined variable: settings in /путь/до/класса/Settings.php on line 31
return $$data;
return [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'keyN' => 'valueN',
];
$array = include_once('file.php');