Does this usage make sense? Will it cause any problems later?
function model($folder, $file)
{
global $db;
if (is_file(path . 'app/models/' . $folder . '/' . $file . '.php')) {
require_once(path . 'app/models/' . $folder . '/' . $file . '.php');
return new $file($db);
}
}
echo model('admin', 'common')->get();
New contributor
user25689248 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.