Reputation: 35265
Does (a) have any benefits over (b)?
a) A function that returns the path to the file.
include util("array");
function util($name)
{
return PATH."utils/$name.php";
}
b) A function that directly includes the file.
util("array");
function util($name)
{
include PATH."utils/$name.php";
}
Upvotes: 0
Views: 85
Reputation: 1429
I'd take the second option, because it would allow you to switch between include()
, include_once()
, require()
and require_once()
easily, in case you ever need that.
Upvotes: 2